@agenticprimitives/agent-account 1.0.0-alpha.25 → 1.0.0-alpha.27

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @agenticprimitives/agent-account
2
2
 
3
+ > Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)
4
+
3
5
  **The address IS the identity.**
4
6
 
5
7
  Every person, organization, service agent, and treasury in this stack is an ERC-4337 Smart Agent address (`0x…` / CAIP-10 `eip155:<chainId>:<address>`). Not a username with a wallet attached — the address itself is the canonical identity, and everything else (names, passkeys, profiles, registry entries) is a replaceable facet pointing at it. This package is where that anchor comes from: it derives the address counterfactually, deploys the account, builds UserOperations, and verifies ERC-1271 signatures.
package/dist/abis.d.ts CHANGED
@@ -202,6 +202,85 @@ export declare const agentAccountAbi: readonly [{
202
202
  readonly outputs: readonly [{
203
203
  readonly type: "uint256";
204
204
  }];
205
+ }, {
206
+ readonly type: "function";
207
+ readonly name: "custodyEpoch";
208
+ readonly stateMutability: "view";
209
+ readonly inputs: readonly [];
210
+ readonly outputs: readonly [{
211
+ readonly type: "uint64";
212
+ }];
213
+ }, {
214
+ readonly type: "function";
215
+ readonly name: "approvedHashKey";
216
+ readonly stateMutability: "view";
217
+ readonly inputs: readonly [{
218
+ readonly name: "hash";
219
+ readonly type: "bytes32";
220
+ }];
221
+ readonly outputs: readonly [{
222
+ readonly type: "bytes32";
223
+ }];
224
+ }, {
225
+ readonly type: "event";
226
+ readonly name: "CustodyEpochBumped";
227
+ readonly inputs: readonly [{
228
+ readonly name: "epoch";
229
+ readonly type: "uint64";
230
+ readonly indexed: false;
231
+ }];
232
+ }, {
233
+ readonly type: "function";
234
+ readonly name: "approveDigest";
235
+ readonly stateMutability: "nonpayable";
236
+ readonly inputs: readonly [{
237
+ readonly name: "digest";
238
+ readonly type: "bytes32";
239
+ }];
240
+ readonly outputs: readonly [];
241
+ }, {
242
+ readonly type: "function";
243
+ readonly name: "revokeDigest";
244
+ readonly stateMutability: "nonpayable";
245
+ readonly inputs: readonly [{
246
+ readonly name: "digest";
247
+ readonly type: "bytes32";
248
+ }];
249
+ readonly outputs: readonly [];
250
+ }, {
251
+ readonly type: "function";
252
+ readonly name: "revokeAllApprovedDigests";
253
+ readonly stateMutability: "nonpayable";
254
+ readonly inputs: readonly [];
255
+ readonly outputs: readonly [];
256
+ }, {
257
+ readonly type: "event";
258
+ readonly name: "DigestApproved";
259
+ readonly inputs: readonly [{
260
+ readonly name: "digest";
261
+ readonly type: "bytes32";
262
+ readonly indexed: true;
263
+ }, {
264
+ readonly name: "epoch";
265
+ readonly type: "uint64";
266
+ readonly indexed: false;
267
+ }];
268
+ }, {
269
+ readonly type: "event";
270
+ readonly name: "DigestRevoked";
271
+ readonly inputs: readonly [{
272
+ readonly name: "digest";
273
+ readonly type: "bytes32";
274
+ readonly indexed: true;
275
+ }, {
276
+ readonly name: "epoch";
277
+ readonly type: "uint64";
278
+ readonly indexed: false;
279
+ }];
280
+ }, {
281
+ readonly type: "event";
282
+ readonly name: "AllDigestsRevoked";
283
+ readonly inputs: readonly [];
205
284
  }, {
206
285
  readonly type: "function";
207
286
  readonly name: "factory";
@@ -385,6 +464,10 @@ export declare const agentAccountAbi: readonly [{
385
464
  * ECDSA sig. `QuorumEnforcer.beforeHook` (and the
386
465
  * `_verifyQuorum(..., guardianMode=true)` path in AgentAccount) check
387
466
  * `isApproved(signer, hash)` for v=1 slots in the packed blob.
467
+ *
468
+ * R917-C-2 (spec 408 §1.2): an AgentAccount's `0x03` ERC-1271 sentinel consults
469
+ * `isApproved(account, approvedHashKey(hash))` — the EPOCH-BOUND key, never the raw
470
+ * hash. Approve with `approvedHashKey(hash, epoch)` from `./approved-hash.js`.
388
471
  */
389
472
  export declare const approvedHashRegistryAbi: readonly [{
390
473
  readonly type: "function";
@@ -418,6 +501,23 @@ export declare const approvedHashRegistryAbi: readonly [{
418
501
  readonly outputs: readonly [{
419
502
  readonly type: "bool";
420
503
  }];
504
+ }, {
505
+ readonly type: "function";
506
+ readonly name: "revokeAll";
507
+ readonly stateMutability: "nonpayable";
508
+ readonly inputs: readonly [];
509
+ readonly outputs: readonly [];
510
+ }, {
511
+ readonly type: "function";
512
+ readonly name: "epochOf";
513
+ readonly stateMutability: "view";
514
+ readonly inputs: readonly [{
515
+ readonly name: "signer";
516
+ readonly type: "address";
517
+ }];
518
+ readonly outputs: readonly [{
519
+ readonly type: "uint64";
520
+ }];
421
521
  }];
422
522
  /** ERC-1271 magic value returned by isValidSignature on success. */
423
523
  export { ERC1271_MAGIC_VALUE } from '@agenticprimitives/types';
@@ -1 +1 @@
1
- {"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EzB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDlB,CAAC;AAKX;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyB1B,CAAC;AAEX,oEAAo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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8EhB,CAAC"}
package/dist/abis.js CHANGED
@@ -124,6 +124,19 @@ export const agentAccountAbi = [
124
124
  },
125
125
  { type: 'function', name: 'isCustodian', stateMutability: 'view', inputs: [{ name: 'account', type: 'address' }], outputs: [{ type: 'bool' }] },
126
126
  { type: 'function', name: 'custodianCount', stateMutability: 'view', inputs: [], outputs: [{ type: 'uint256' }] },
127
+ // R917-C-2 (spec 408 §1.2) — the custody epoch and the epoch-bound key the 0x03 sentinel consults.
128
+ { type: 'function', name: 'custodyEpoch', stateMutability: 'view', inputs: [], outputs: [{ type: 'uint64' }] },
129
+ { type: 'function', name: 'approvedHashKey', stateMutability: 'view', inputs: [{ name: 'hash', type: 'bytes32' }], outputs: [{ type: 'bytes32' }] },
130
+ { type: 'event', name: 'CustodyEpochBumped', inputs: [{ name: 'epoch', type: 'uint64', indexed: false }] },
131
+ // Spec 410 §1 (generation 3, THESIS-1a) — the account derives the approved-hash key itself; the registry is
132
+ // never an execute target. `approveDigest` / `revokeDigest` are onlySelf; `revokeAllApprovedDigests` is
133
+ // custody-gated on a governed account and the last step of every recovery path.
134
+ { type: 'function', name: 'approveDigest', stateMutability: 'nonpayable', inputs: [{ name: 'digest', type: 'bytes32' }], outputs: [] },
135
+ { type: 'function', name: 'revokeDigest', stateMutability: 'nonpayable', inputs: [{ name: 'digest', type: 'bytes32' }], outputs: [] },
136
+ { type: 'function', name: 'revokeAllApprovedDigests', stateMutability: 'nonpayable', inputs: [], outputs: [] },
137
+ { type: 'event', name: 'DigestApproved', inputs: [{ name: 'digest', type: 'bytes32', indexed: true }, { name: 'epoch', type: 'uint64', indexed: false }] },
138
+ { type: 'event', name: 'DigestRevoked', inputs: [{ name: 'digest', type: 'bytes32', indexed: true }, { name: 'epoch', type: 'uint64', indexed: false }] },
139
+ { type: 'event', name: 'AllDigestsRevoked', inputs: [] },
127
140
  { type: 'function', name: 'factory', stateMutability: 'view', inputs: [], outputs: [{ type: 'address' }] },
128
141
  { type: 'function', name: 'delegationManager', stateMutability: 'view', inputs: [], outputs: [{ type: 'address' }] },
129
142
  // Phase 6f.4 — passkey-direct custody surface.
@@ -156,6 +169,10 @@ export const agentAccountAbi = [
156
169
  * ECDSA sig. `QuorumEnforcer.beforeHook` (and the
157
170
  * `_verifyQuorum(..., guardianMode=true)` path in AgentAccount) check
158
171
  * `isApproved(signer, hash)` for v=1 slots in the packed blob.
172
+ *
173
+ * R917-C-2 (spec 408 §1.2): an AgentAccount's `0x03` ERC-1271 sentinel consults
174
+ * `isApproved(account, approvedHashKey(hash))` — the EPOCH-BOUND key, never the raw
175
+ * hash. Approve with `approvedHashKey(hash, epoch)` from `./approved-hash.js`.
159
176
  */
160
177
  export const approvedHashRegistryAbi = [
161
178
  {
@@ -182,6 +199,9 @@ export const approvedHashRegistryAbi = [
182
199
  ],
183
200
  outputs: [{ type: 'bool' }],
184
201
  },
202
+ // R917-C-2 — void every approval the signer ever made, in one call; `epochOf` is informational.
203
+ { type: 'function', name: 'revokeAll', stateMutability: 'nonpayable', inputs: [], outputs: [] },
204
+ { type: 'function', name: 'epochOf', stateMutability: 'view', inputs: [{ name: 'signer', type: 'address' }], outputs: [{ type: 'uint64' }] },
185
205
  ];
186
206
  /** ERC-1271 magic value returned by isValidSignature on success. */
187
207
  // The protocol constant lives in `types` — the one package everything may import, including
package/dist/abis.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"abis.js","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,sFAAsF;AACtF,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,0CAA0C;AAE1C,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,OAAO;IACb,UAAU,EAAE;QACV,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;QAC/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AO,EAAE;SACjC;KACF;CACO,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ import { agentAccountAbi } from './abis.js';
3
+ import type { ContractCall } from './execute.js';
4
+ /** Which contracts an estate runs: 1 = pre-spec-408 (raw approved hashes, 32-byte digest-binding args,
5
+ * `anchorOf(digest)`); 2 = spec 408 (epoch-bound keys, per-step nonces, `anchorOf(agent, digest)`);
6
+ * 3 = spec 410 (`approveDigest` on the account, the registry never an execute target, `RotateCredential`,
7
+ * `revokeAll` at the end of every recovery path). */
8
+ export type ContractsGeneration = 1 | 2 | 3;
9
+ /** The generation a deployments JSON records; absent ⇒ 1 (the field arrived with spec 408). Anything else throws. */
10
+ export declare function contractsGenerationOf(deployments: {
11
+ contractsGeneration?: unknown;
12
+ } | null | undefined): ContractsGeneration;
13
+ /** How an approval is keyed on this estate: generation 1 approves the raw digest; generation 2 the epoch-bound
14
+ * key, computed here; generation 3 approves the DIGEST through the account, which derives the key itself —
15
+ * the scheme names the account because the approval is a self-call on it. */
16
+ export type ApprovalScheme = {
17
+ generation: 1;
18
+ } | {
19
+ generation: 2;
20
+ epoch: bigint | number;
21
+ } | {
22
+ generation: 3;
23
+ account: Address;
24
+ };
25
+ /** The 32 bytes the account approves for `digest` under `scheme`. On generation 3 there is nothing for a caller
26
+ * to compute — the account derives the key on chain — so this throws rather than guess an epoch (ADR-0013). */
27
+ export declare function approvalKey(digest: Hex, scheme: ApprovalScheme): Hex;
28
+ /** The scheme for `account` on an estate of `generation`: generation 1 needs no read; generation 2 reads the
29
+ * account's custody epoch (0 for an address with no code); generation 3 needs no read either — the account
30
+ * will derive the key under whatever epoch it is in when the call lands. */
31
+ export declare function readApprovalScheme(client: {
32
+ getCode(args: {
33
+ address: Address;
34
+ }): Promise<Hex | undefined>;
35
+ readContract(args: {
36
+ address: Address;
37
+ abi: typeof agentAccountAbi;
38
+ functionName: 'custodyEpoch';
39
+ }): Promise<bigint>;
40
+ }, account: Address, generation: ContractsGeneration): Promise<ApprovalScheme>;
41
+ /** The 32 bytes an account must approve for `digest` to validate through its `0x03` sentinel at `epoch`. */
42
+ export declare function approvedHashKey(digest: Hex, epoch: bigint | number): Hex;
43
+ /** The one read: a deployed account answers `custodyEpoch()`; an address with no code is at epoch 0. */
44
+ export declare function readCustodyEpoch(client: {
45
+ getCode(args: {
46
+ address: Address;
47
+ }): Promise<Hex | undefined>;
48
+ readContract(args: {
49
+ address: Address;
50
+ abi: typeof agentAccountAbi;
51
+ functionName: 'custodyEpoch';
52
+ }): Promise<bigint>;
53
+ }, account: Address): Promise<bigint>;
54
+ /** `ApprovedHashRegistry.approveHash(approvalKey(digest, scheme))` as a `ContractCall` for the account's own
55
+ * execute/executeBatch. The scheme is REQUIRED so a caller states which estate generation and (on generation 2)
56
+ * which custody set it is approving under — `{ generation: 2, epoch: 0n }` for a counterfactual account being
57
+ * deployed in the same batch. */
58
+ export declare function buildApproveHashCall(registry: Address, digest: Hex, scheme: ApprovalScheme): ContractCall;
59
+ /** `ApprovedHashRegistry.revokeAll()` as a `ContractCall`: void every approval the account ever made.
60
+ * Generations 1 and 2 only — on generation 3 the registry is not an execute target; use
61
+ * `buildRevokeAllApprovedDigestsCall(account)`. */
62
+ export declare function buildRevokeAllApprovedHashesCall(registry: Address): ContractCall;
63
+ /** Spec 410 §1 (generation 3) — `AgentAccount.revokeAllApprovedDigests()` as a self-call: void every approval
64
+ * the account ever made, under any epoch, including one planted for a future epoch. The last step of a
65
+ * mode-0 self-recovery batch; `CustodyPolicy` does the same for every governed recovery. */
66
+ export declare function buildRevokeAllApprovedDigestsCall(account: Address): ContractCall;
67
+ /** A credential to register or retire. */
68
+ export type CredentialRef = {
69
+ kind: 'custodian';
70
+ address: Address;
71
+ } | {
72
+ kind: 'passkey';
73
+ credentialIdDigest: Hex;
74
+ x: bigint;
75
+ y: bigint;
76
+ rpIdHash: Hex;
77
+ };
78
+ /** Spec 410 §1.2 — the mode-0 ROTATION batch: `add → retire → approveDigest × N`. Order is the builder's, not
79
+ * the caller's: the account is never credential-less, and every re-approval lands after the retirement so
80
+ * the account derives each key under the NEW epoch. Generation 3 only — an older estate has no
81
+ * `approveDigest`, and pretending with a computed future-epoch key is the exact hole this closes. */
82
+ export declare function buildRotationBatch(args: {
83
+ scheme: ApprovalScheme;
84
+ add: CredentialRef;
85
+ retire: {
86
+ kind: 'custodian';
87
+ address: Address;
88
+ } | {
89
+ kind: 'passkey';
90
+ credentialIdDigest: Hex;
91
+ };
92
+ /** Every standing approved-digest wire the account issued — the reviewed list. */
93
+ reapprove: readonly Hex[];
94
+ }): ContractCall[];
95
+ /** Spec 410 §1.2 — the mode-0 SELF-RECOVERY batch: `add → retire → revokeAllApprovedDigests`. It carries no
96
+ * re-approval list — the type has no field for one. Generation 3 only. */
97
+ export declare function buildSelfRecoveryBatch(args: {
98
+ scheme: ApprovalScheme;
99
+ add: CredentialRef;
100
+ retire: {
101
+ kind: 'custodian';
102
+ address: Address;
103
+ } | {
104
+ kind: 'passkey';
105
+ credentialIdDigest: Hex;
106
+ };
107
+ }): ContractCall[];
108
+ //# sourceMappingURL=approved-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approved-hash.d.ts","sourceRoot":"","sources":["../src/approved-hash.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAsD,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAClG,OAAO,EAAE,eAAe,EAA2B,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;sDAGsD;AACtD,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C,qHAAqH;AACrH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE;IAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,CAM5H;AAED;;8EAE8E;AAC9E,MAAM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,kBAAkB,EAAE,GAAG,CAAA;KAAE,CAAC;CAChG,GAAG,YAAY,EAAE,CAIjB"}
@@ -0,0 +1,139 @@
1
+ // R917-C-2 (spec 408 §1.2) — THE EPOCH-BOUND APPROVED-HASH KEY.
2
+ //
3
+ // An AgentAccount's `0x03` ERC-1271 sentinel does not ask the ApprovedHashRegistry about the raw digest;
4
+ // it asks about `keccak256(abi.encode(digest, custodyEpoch))`, where the custody epoch increments every
5
+ // time the account retires a credential (`removeCustodian`, `removePasskey` — recovery and rotation
6
+ // remove through these). So an approval planted by a custodian who is later removed is void the moment
7
+ // the custody set no longer contains that custodian: an ECDSA signature dies with its key, and an
8
+ // approved hash dies with its custody set.
9
+ //
10
+ // What an SDK does: read the account's epoch (0 for a counterfactual account — a deploy-and-approve
11
+ // batch, spec 253, is computable before the address has code) and approve the KEY. After a custodian
12
+ // removal the account's standing approved-hash wires are re-approved under the new epoch — in one batch,
13
+ // as the ceremony already does.
14
+ //
15
+ // THREE CONTRACT GENERATIONS. An estate whose contracts predate spec 408 (`contractsGeneration` absent from its
16
+ // deployments JSON = generation 1) has accounts with no epoch: the sentinel there consults the RAW digest.
17
+ // Generation 2 (spec 408) approves the epoch-bound KEY, computed here and sent to the registry. Generation 3
18
+ // (spec 410 §1, THESIS-1a) closes the hole generation 2 left — a caller who can compute the key can compute it
19
+ // for a FUTURE epoch, and the registry stores whatever it is sent — by making the ACCOUNT derive the key on
20
+ // chain (`approveDigest`) and refusing the registry as an execute target for every caller. On generation 3 an
21
+ // SDK never computes a key: it asks the account to approve the DIGEST. The generation is a DEPLOYMENT FACT the
22
+ // app states (`CONTRACTS_GENERATION`), never inferred from a failed read (ADR-0013): one mechanism per
23
+ // generation, chosen by configuration.
24
+ import { encodeAbiParameters, encodeFunctionData, keccak256 } from 'viem';
25
+ import { agentAccountAbi, approvedHashRegistryAbi } from './abis.js';
26
+ /** The generation a deployments JSON records; absent ⇒ 1 (the field arrived with spec 408). Anything else throws. */
27
+ export function contractsGenerationOf(deployments) {
28
+ const g = deployments?.contractsGeneration;
29
+ if (g === undefined || g === null || g === 1 || g === '1')
30
+ return 1;
31
+ if (g === 2 || g === '2')
32
+ return 2;
33
+ if (g === 3 || g === '3')
34
+ return 3;
35
+ throw new Error(`contractsGeneration ${String(g)} is not a generation this SDK knows (1, 2 or 3)`);
36
+ }
37
+ /** The 32 bytes the account approves for `digest` under `scheme`. On generation 3 there is nothing for a caller
38
+ * to compute — the account derives the key on chain — so this throws rather than guess an epoch (ADR-0013). */
39
+ export function approvalKey(digest, scheme) {
40
+ if (!/^0x[0-9a-fA-F]{64}$/.test(digest))
41
+ throw new Error('approvalKey: digest must be a bytes32 hex string');
42
+ if (scheme.generation === 1)
43
+ return digest;
44
+ if (scheme.generation === 2)
45
+ return approvedHashKey(digest, scheme.epoch);
46
+ throw new Error('approvalKey: on generation 3 the account derives the key on chain (approveDigest); read approvedHashKey(digest) from the account if you need the stored key');
47
+ }
48
+ /** The scheme for `account` on an estate of `generation`: generation 1 needs no read; generation 2 reads the
49
+ * account's custody epoch (0 for an address with no code); generation 3 needs no read either — the account
50
+ * will derive the key under whatever epoch it is in when the call lands. */
51
+ export async function readApprovalScheme(client, account, generation) {
52
+ if (generation === 1)
53
+ return { generation: 1 };
54
+ if (generation === 3)
55
+ return { generation: 3, account };
56
+ return { generation: 2, epoch: await readCustodyEpoch(client, account) };
57
+ }
58
+ /** The 32 bytes an account must approve for `digest` to validate through its `0x03` sentinel at `epoch`. */
59
+ export function approvedHashKey(digest, epoch) {
60
+ if (!/^0x[0-9a-fA-F]{64}$/.test(digest))
61
+ throw new Error('approvedHashKey: digest must be a bytes32 hex string');
62
+ const e = BigInt(epoch);
63
+ if (e < 0n || e > 0xffffffffffffffffn)
64
+ throw new Error('approvedHashKey: epoch must fit uint64');
65
+ return keccak256(encodeAbiParameters([{ type: 'bytes32' }, { type: 'uint64' }], [digest, e]));
66
+ }
67
+ /** The one read: a deployed account answers `custodyEpoch()`; an address with no code is at epoch 0. */
68
+ export async function readCustodyEpoch(client, account) {
69
+ const code = await client.getCode({ address: account });
70
+ if (!code || code === '0x')
71
+ return 0n;
72
+ return BigInt(await client.readContract({ address: account, abi: agentAccountAbi, functionName: 'custodyEpoch' }));
73
+ }
74
+ /** `ApprovedHashRegistry.approveHash(approvalKey(digest, scheme))` as a `ContractCall` for the account's own
75
+ * execute/executeBatch. The scheme is REQUIRED so a caller states which estate generation and (on generation 2)
76
+ * which custody set it is approving under — `{ generation: 2, epoch: 0n }` for a counterfactual account being
77
+ * deployed in the same batch. */
78
+ export function buildApproveHashCall(registry, digest, scheme) {
79
+ if (scheme.generation === 3) {
80
+ // Spec 410 §1: a self-call — the account computes the key under the epoch it is in. `registry` is not a
81
+ // target on this generation (the account refuses it), so it is deliberately unused here.
82
+ if (!/^0x[0-9a-fA-F]{64}$/.test(digest))
83
+ throw new Error('buildApproveHashCall: digest must be a bytes32 hex string');
84
+ return { to: scheme.account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'approveDigest', args: [digest] }) };
85
+ }
86
+ return {
87
+ to: registry,
88
+ value: 0n,
89
+ data: encodeFunctionData({ abi: approvedHashRegistryAbi, functionName: 'approveHash', args: [approvalKey(digest, scheme)] }),
90
+ };
91
+ }
92
+ /** `ApprovedHashRegistry.revokeAll()` as a `ContractCall`: void every approval the account ever made.
93
+ * Generations 1 and 2 only — on generation 3 the registry is not an execute target; use
94
+ * `buildRevokeAllApprovedDigestsCall(account)`. */
95
+ export function buildRevokeAllApprovedHashesCall(registry) {
96
+ return { to: registry, value: 0n, data: encodeFunctionData({ abi: approvedHashRegistryAbi, functionName: 'revokeAll' }) };
97
+ }
98
+ /** Spec 410 §1 (generation 3) — `AgentAccount.revokeAllApprovedDigests()` as a self-call: void every approval
99
+ * the account ever made, under any epoch, including one planted for a future epoch. The last step of a
100
+ * mode-0 self-recovery batch; `CustodyPolicy` does the same for every governed recovery. */
101
+ export function buildRevokeAllApprovedDigestsCall(account) {
102
+ return { to: account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'revokeAllApprovedDigests' }) };
103
+ }
104
+ function credentialAddCall(account, c) {
105
+ return c.kind === 'custodian'
106
+ ? { to: account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'addCustodian', args: [c.address] }) }
107
+ : { to: account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'addPasskey', args: [c.credentialIdDigest, c.x, c.y, c.rpIdHash] }) };
108
+ }
109
+ function credentialRetireCall(account, c) {
110
+ return c.kind === 'custodian'
111
+ ? { to: account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'removeCustodian', args: [c.address] }) }
112
+ : { to: account, value: 0n, data: encodeFunctionData({ abi: agentAccountAbi, functionName: 'removePasskey', args: [c.credentialIdDigest] }) };
113
+ }
114
+ /** Spec 410 §1.2 — the mode-0 ROTATION batch: `add → retire → approveDigest × N`. Order is the builder's, not
115
+ * the caller's: the account is never credential-less, and every re-approval lands after the retirement so
116
+ * the account derives each key under the NEW epoch. Generation 3 only — an older estate has no
117
+ * `approveDigest`, and pretending with a computed future-epoch key is the exact hole this closes. */
118
+ export function buildRotationBatch(args) {
119
+ if (args.scheme.generation !== 3)
120
+ throw new Error('buildRotationBatch: the rotation ceremony needs contracts generation 3 (spec 410 §1); this estate runs ' + args.scheme.generation);
121
+ const account = args.scheme.account;
122
+ for (const d of args.reapprove)
123
+ if (!/^0x[0-9a-fA-F]{64}$/.test(d))
124
+ throw new Error('buildRotationBatch: every reapprove entry must be a bytes32 digest');
125
+ return [
126
+ credentialAddCall(account, args.add),
127
+ credentialRetireCall(account, args.retire),
128
+ ...args.reapprove.map((d) => buildApproveHashCall(account, d, args.scheme)),
129
+ ];
130
+ }
131
+ /** Spec 410 §1.2 — the mode-0 SELF-RECOVERY batch: `add → retire → revokeAllApprovedDigests`. It carries no
132
+ * re-approval list — the type has no field for one. Generation 3 only. */
133
+ export function buildSelfRecoveryBatch(args) {
134
+ if (args.scheme.generation !== 3)
135
+ throw new Error('buildSelfRecoveryBatch: needs contracts generation 3 (spec 410 §1); this estate runs ' + args.scheme.generation);
136
+ const account = args.scheme.account;
137
+ return [credentialAddCall(account, args.add), credentialRetireCall(account, args.retire), buildRevokeAllApprovedDigestsCall(account)];
138
+ }
139
+ //# sourceMappingURL=approved-hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approved-hash.js","sourceRoot":"","sources":["../src/approved-hash.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,yGAAyG;AACzG,wGAAwG;AACxG,oGAAoG;AACpG,uGAAuG;AACvG,kGAAkG;AAClG,2CAA2C;AAC3C,EAAE;AACF,oGAAoG;AACpG,qGAAqG;AACrG,yGAAyG;AACzG,gCAAgC;AAChC,EAAE;AACF,gHAAgH;AAChH,2GAA2G;AAC3G,6GAA6G;AAC7G,+GAA+G;AAC/G,4GAA4G;AAC5G,8GAA8G;AAC9G,+GAA+G;AAC/G,uGAAuG;AACvG,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,SAAS,EAA0B,MAAM,MAAM,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AASrE,qHAAqH;AACrH,MAAM,UAAU,qBAAqB,CAAC,WAAiE;IACrG,MAAM,CAAC,GAAG,WAAW,EAAE,mBAAmB,CAAC;IAC3C,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG;QAAE,OAAO,CAAC,CAAC;IACnC,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,CAAC,CAAC,CAAC,iDAAiD,CAA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wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAG1E;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;gBAE7B,IAAI,EAAE,iBAAiB;IAQnC;;;;OAIG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IAS9D;;;;;;OAMG;IACG,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IASlE;;;;;;;;;;;OAWG;IACG,WAAW,CACf,OAAO,EAAE,mBAAmB,EAAE,EAC9B,WAAW,EAAE,OAAO,EAEpB,WAAW,EAAE,GAAG,GACf,OAAO,CAAC,kBAAkB,CAAC;CAkE/B"}
@@ -13,6 +13,8 @@
13
13
  // pays gas it gets reimbursed for (paymaster.deposit → EntryPoint → us).
14
14
  import { createPublicClient, createWalletClient, http, } from 'viem';
15
15
  import { entryPointAbi } from './abis.js';
16
+ /** keccak256("UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)") — EntryPoint v0.7. */
17
+ const USER_OPERATION_EVENT_TOPIC = '0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f';
16
18
  /** Pack two uint128s into a single bytes32. high << 128 | low. */
17
19
  export function packGasLimits(high, low) {
18
20
  if (high < 0n || high >= 1n << 128n)
@@ -94,24 +96,61 @@ export class BundlerClient {
94
96
  const { high: verificationGasLimit, low: callGasLimit } = unpackGasLimits(op.accountGasLimits);
95
97
  return sum + verificationGasLimit + callGasLimit + BigInt(op.preVerificationGas);
96
98
  }, 0n) + 150000n * BigInt(userOps.length) + 100000n;
97
- const hash = await wallet.writeContract({
98
- address: this.opts.entryPoint,
99
- abi: entryPointAbi,
100
- functionName: 'handleOps',
101
- args: [userOps, beneficiary],
102
- account: viemAccount,
103
- chain: null,
104
- gas: handleOpsGas,
105
- });
106
- // Generous timeout + tight polling: faithchain (QBFT free-gas) can take tens of seconds per
107
- // block, and a shorter wait throws WaitForTransactionReceiptTimeoutError even though the tx
108
- // mines. pollingInterval override keeps detection prompt once the block lands.
109
- return this.publicClient.waitForTransactionReceipt({
110
- hash,
111
- timeout: 180_000,
112
- pollingInterval: this.opts.pollingIntervalMs ?? 2_000,
113
- retryCount: 20,
114
- });
99
+ /**
100
+ * THE RECEIPT MUST BE OURS (2026-09-18). One relayer key serves more than one path — a deploy here, an
101
+ * approval on the harness — and viem picks each transaction's nonce from `pending` at send time, so two
102
+ * concurrent sends take the same nonce. One is mined; the other is REPLACED, and `waitForTransactionReceipt`
103
+ * then resolves with the replacement's receipt (that is its documented behaviour), which carries the other
104
+ * path's UserOperationEvent and none of ours. Seen live as "this userOp is not in that transaction —
105
+ * sendersSeen=[the harness]" on a workspace deploy, and as "Nonce provided … is lower than the current"
106
+ * from the other side. A receipt without our op is not our receipt: the send is made again, with a fresh
107
+ * nonce, a few times. The userOps themselves are unchanged and still valid — their nonces are the accounts'.
108
+ */
109
+ const ours = new Set(userOps.map((op) => op.sender.toLowerCase()));
110
+ const entry = this.opts.entryPoint.toLowerCase();
111
+ // "Somebody else's, and not ours" is the replaced case; a receipt with no UserOperationEvent at all is left to
112
+ // the caller to judge (the inner-failure check reads it), and a receipt without logs is not judged here.
113
+ const replacedUnderUs = (receipt) => {
114
+ const events = (receipt.logs ?? []).filter((l) => l.address.toLowerCase() === entry && l.topics[0]?.toLowerCase() === USER_OPERATION_EVENT_TOPIC);
115
+ return events.length > 0 && !events.some((l) => ours.has(`0x${(l.topics[2] ?? '').slice(-40).toLowerCase()}`));
116
+ };
117
+ let last = null;
118
+ for (let attempt = 0; attempt < 3; attempt++) {
119
+ let hash;
120
+ try {
121
+ hash = await wallet.writeContract({
122
+ address: this.opts.entryPoint,
123
+ abi: entryPointAbi,
124
+ functionName: 'handleOps',
125
+ args: [userOps, beneficiary],
126
+ account: viemAccount,
127
+ chain: null,
128
+ gas: handleOpsGas,
129
+ });
130
+ }
131
+ catch (e) {
132
+ // The collision seen from the losing side: the nonce viem chose was spent under us. Once more, fresh.
133
+ if (attempt < 2 && /nonce/i.test(String(e))) {
134
+ await new Promise((r) => setTimeout(r, 1500 * (attempt + 1)));
135
+ continue;
136
+ }
137
+ throw e;
138
+ }
139
+ // Generous timeout + tight polling: faithchain (QBFT free-gas) can take tens of seconds per
140
+ // block, and a shorter wait throws WaitForTransactionReceiptTimeoutError even though the tx
141
+ // mines. pollingInterval override keeps detection prompt once the block lands.
142
+ const receipt = await this.publicClient.waitForTransactionReceipt({
143
+ hash,
144
+ timeout: 180_000,
145
+ pollingInterval: this.opts.pollingIntervalMs ?? 2_000,
146
+ retryCount: 20,
147
+ });
148
+ last = receipt;
149
+ if (!replacedUnderUs(receipt))
150
+ return receipt;
151
+ console.warn(`[bundler] tx ${receipt.transactionHash} carries none of our userOps (replaced under us) — sending again (${attempt + 1}/3)`);
152
+ }
153
+ return last;
115
154
  }
116
155
  }
117
156
  //# sourceMappingURL=bundler-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler-client.js","sourceRoot":"","sources":["../src/bundler-client.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,yDAAyD;AACzD,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,qEAAqE;AACrE,kEAAkE;AAClE,uEAAuE;AACvE,yEAAyE;AACzE,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,yEAAyE;AAEzE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,GAKL,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AA+B1C,kEAAkE;AAClE,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,GAAW;IACrD,IAAI,IAAI,GAAG,EAAE,IAAI,IA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AO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oBAAC,SAAS;gBAAC,CAAC;gBACzH,MAAM,CAAC,CAAC;YACV,CAAC;YACD,4FAA4F;YAC5F,4FAA4F;YAC5F,+EAA+E;YAC/E,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC;gBAChE,IAAI;gBACJ,OAAO,EAAE,OAAO;gBAChB,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,iBAAiB,IAAI,KAAK;gBACrD,UAAU,EAAE,EAAE;aACf,CAAC,CAAC;YACH,IAAI,GAAG,OAAO,CAAC;YACf,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBAAE,OAAO,OAAO,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,eAAe,qEAAqE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7I,CAAC;QACD,OAAO,IAAK,CAAC;IACf,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { buildErc20TransferCall, readErc20Balance } from './erc20.js';
6
6
  export { BundlerClient, packGasLimits, unpackGasLimits } from './bundler-client.js';
7
7
  export type { BundlerClientOpts, PackedUserOperation } from './bundler-client.js';
8
8
  export { agentAccountAbi, agentAccountFactoryAbi, approvedHashRegistryAbi, entryPointAbi, } from './abis.js';
9
+ export { approvedHashKey, approvalKey, readCustodyEpoch, readApprovalScheme, contractsGenerationOf, buildApproveHashCall, buildRevokeAllApprovedHashesCall, buildRevokeAllApprovedDigestsCall, buildRotationBatch, buildSelfRecoveryBatch, type ApprovalScheme, type ContractsGeneration, type CredentialRef } from './approved-hash.js';
9
10
  export { packSafeSignatures, } from './quorum.js';
10
11
  export type { SafeSignatureSlot } from './quorum.js';
11
12
  export { SIG_TYPE_WEBAUTHN, encodeAssertion, encodeWebAuthnSignature, } from './webauthn-signature.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AAInB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOrD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGzU,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOrD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -8,6 +8,8 @@ export { buildErc20TransferCall, readErc20Balance } from './erc20.js';
8
8
  export { BundlerClient, packGasLimits, unpackGasLimits } from './bundler-client.js';
9
9
  export { agentAccountAbi, agentAccountFactoryAbi, approvedHashRegistryAbi, entryPointAbi, } from './abis.js';
10
10
  // custodyPolicyAbi moved to @agenticprimitives/account-custody (spec 213 § 2.6).
11
+ // R917-C-2 (spec 408 §1.2) — the epoch-bound approved-hash key the 0x03 sentinel consults.
12
+ export { approvedHashKey, approvalKey, readCustodyEpoch, readApprovalScheme, contractsGenerationOf, buildApproveHashCall, buildRevokeAllApprovedHashesCall, buildRevokeAllApprovedDigestsCall, buildRotationBatch, buildSelfRecoveryBatch } from './approved-hash.js';
11
13
  // Spec 207 threshold-policy + quorum utilities (6c.3-c).
12
14
  export { packSafeSignatures, } from './quorum.js';
13
15
  // WebAuthn on-chain signature wire format (spec 130).
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,8DAA8D;AAE9D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAqB,MAAM,cAAc,CAAC;AAClG,gEAAgE;AAChE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,iFAAiF;AAEjF,yDAAyD;AACzD,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,sDAAsD;AACtD,wEAAwE;AACxE,mEAAmE;AACnE,wDAAwD;AACxD,wCAAwC;AACxC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,8DAA8D;AAE9D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAqB,MAAM,cAAc,CAAC;AAClG,gEAAgE;AAChE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,iFAAiF;AACjF,2FAA2F;AAC3F,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,iCAAiC,EAAE,kBAAkB,EAAE,sBAAsB,EAAqE,MAAM,oBAAoB,CAAC;AAEzU,yDAAyD;AACzD,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,sDAAsD;AACtD,wEAAwE;AACxE,mEAAmE;AACnE,wDAAwD;AACxD,wCAAwC;AACxC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "@agenticprimitives/agent-account",
3
- "version": "1.0.0-alpha.25",
3
+ "version": "1.0.0-alpha.27",
4
4
  "description": "ERC-4337 smart-account substrate: deterministic addressing, factory deployment, ERC-1271 signing, UserOp building.",
5
+ "homepage": "https://agenticprimitives.dev",
6
+ "bugs": {
7
+ "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
8
+ },
9
+ "author": {
10
+ "name": "Agentic Trust Labs",
11
+ "url": "https://agenticprimitives.dev"
12
+ },
5
13
  "license": "MIT",
6
14
  "repository": {
7
15
  "type": "git",
8
16
  "url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
9
17
  "directory": "packages/agent-account"
10
18
  },
11
- "homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/agent-account",
12
- "bugs": {
13
- "url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
14
- },
15
19
  "type": "module",
16
20
  "main": "./dist/index.js",
17
21
  "types": "./dist/index.d.ts",
@@ -32,8 +36,8 @@
32
36
  },
33
37
  "peerDependencies": {
34
38
  "viem": "^2.52.2",
35
- "@agenticprimitives/connect-auth": "1.0.0-alpha.25",
36
- "@agenticprimitives/types": "1.0.0-alpha.25"
39
+ "@agenticprimitives/connect-auth": "1.0.0-alpha.27",
40
+ "@agenticprimitives/types": "1.0.0-alpha.27"
37
41
  },
38
42
  "devDependencies": {
39
43
  "vitest": "^4.1.8"
@@ -43,7 +47,12 @@
43
47
  "smart-account",
44
48
  "account-abstraction",
45
49
  "erc-1271",
46
- "agentic"
50
+ "agentic",
51
+ "agentic-primitives",
52
+ "agenticprimitives",
53
+ "ai-agents",
54
+ "agent-authority",
55
+ "agentic-trust"
47
56
  ],
48
57
  "scripts": {
49
58
  "build": "tsc -p tsconfig.build.json",