@agenticprimitives/agent-account 0.1.0-alpha.2
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/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/abis.d.ts +543 -0
- package/dist/abis.d.ts.map +1 -0
- package/dist/abis.js +261 -0
- package/dist/abis.js.map +1 -0
- package/dist/bundler-client.d.ts +62 -0
- package/dist/bundler-client.d.ts.map +1 -0
- package/dist/bundler-client.js +95 -0
- package/dist/bundler-client.js.map +1 -0
- package/dist/client.d.ts +224 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +473 -0
- package/dist/client.js.map +1 -0
- package/dist/execute.d.ts +39 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +72 -0
- package/dist/execute.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/quorum.d.ts +62 -0
- package/dist/quorum.d.ts.map +1 -0
- package/dist/quorum.js +103 -0
- package/dist/quorum.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/webauthn-signature.d.ts +34 -0
- package/dist/webauthn-signature.d.ts.map +1 -0
- package/dist/webauthn-signature.js +51 -0
- package/dist/webauthn-signature.js.map +1 -0
- package/package.json +57 -0
- package/spec.md +6 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
// AgentAccountClient — ERC-4337 substrate. Deterministic address + lazy
|
|
2
|
+
// deploy + ERC-1271 verification + UserOp building.
|
|
3
|
+
//
|
|
4
|
+
// Wave R0 — unified API around `createAgentAccount`. The legacy
|
|
5
|
+
// `createPersonAgent` + `createMultiSigSmartAgent` split is gone; mode
|
|
6
|
+
// on the spec picks the shape (0=simple, 1-3=CustodyPolicy installed,
|
|
7
|
+
// trustees required for mode>0).
|
|
8
|
+
import { createPublicClient, createWalletClient, encodeAbiParameters, encodeFunctionData, http, keccak256, getContract, } from 'viem';
|
|
9
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
10
|
+
import { agentAccountFactoryAbi, agentAccountAbi, ERC1271_MAGIC_VALUE } from './abis';
|
|
11
|
+
import { BundlerClient, packGasLimits } from './bundler-client';
|
|
12
|
+
/**
|
|
13
|
+
* Build `paymasterAndData` with the standard v0.7+ prefix:
|
|
14
|
+
* [20 paymaster][16 pmVerifGas][16 pmPostOpGas]
|
|
15
|
+
*
|
|
16
|
+
* When `verifyingPaymaster.signFn` is provided (audit C2), additionally
|
|
17
|
+
* appends `[6 validUntil][6 validAfter][65 signature]`. The signature
|
|
18
|
+
* is produced by passing the canonical hash from
|
|
19
|
+
* `AgentAccountClient.computeVerifyingPaymasterHash` to `signFn` —
|
|
20
|
+
* which MUST EIP-191-wrap the hash (e.g. via viem's `signMessage({ raw })`
|
|
21
|
+
* or a KMS-backed equivalent).
|
|
22
|
+
*
|
|
23
|
+
* The on-chain `SmartAgentPaymaster._validatePaymasterUserOp` recovers
|
|
24
|
+
* the signature via `MessageHashUtils.toEthSignedMessageHash`, matching
|
|
25
|
+
* the EIP-191 wrap. Sig must recover to `verifyingSigner` on the
|
|
26
|
+
* paymaster.
|
|
27
|
+
*/
|
|
28
|
+
async function buildPaymasterAndData(args) {
|
|
29
|
+
const prefix = (args.paymaster +
|
|
30
|
+
args.pmVerifGas.toString(16).padStart(32, '0') +
|
|
31
|
+
args.pmPostOpGas.toString(16).padStart(32, '0'));
|
|
32
|
+
if (!args.verifyingPaymaster)
|
|
33
|
+
return prefix;
|
|
34
|
+
const now = Math.floor(Date.now() / 1000);
|
|
35
|
+
const validUntil = args.verifyingPaymaster.validUntilSeconds ?? now + 3600;
|
|
36
|
+
const validAfter = args.verifyingPaymaster.validAfterSeconds ?? 0;
|
|
37
|
+
const hash = AgentAccountClient.computeVerifyingPaymasterHash({
|
|
38
|
+
userOp: args.userOpFields,
|
|
39
|
+
paymaster: args.paymaster,
|
|
40
|
+
chainId: args.chainId,
|
|
41
|
+
validUntil,
|
|
42
|
+
validAfter,
|
|
43
|
+
});
|
|
44
|
+
const signature = await args.verifyingPaymaster.signFn(hash);
|
|
45
|
+
const validUntilHex = validUntil.toString(16).padStart(12, '0');
|
|
46
|
+
const validAfterHex = validAfter.toString(16).padStart(12, '0');
|
|
47
|
+
const sigStripped = signature.startsWith('0x') ? signature.slice(2) : signature;
|
|
48
|
+
if (sigStripped.length !== 130) {
|
|
49
|
+
throw new Error(`verifyingPaymaster.signFn returned ${sigStripped.length / 2} bytes; expected 65 (r,s,v ECDSA)`);
|
|
50
|
+
}
|
|
51
|
+
return (prefix + validUntilHex + validAfterHex + sigStripped);
|
|
52
|
+
}
|
|
53
|
+
const ZERO_BYTES32 = ('0x' + '00'.repeat(32));
|
|
54
|
+
function _timelockOverridesTuple(spec) {
|
|
55
|
+
const src = spec.timelockOverrides ?? [];
|
|
56
|
+
return [0, 1, 2, 3, 4, 5, 6].map((i) => src[i] ?? 0);
|
|
57
|
+
}
|
|
58
|
+
function _initParamsTuple(spec) {
|
|
59
|
+
return {
|
|
60
|
+
mode: spec.mode ?? 0,
|
|
61
|
+
custodians: spec.custodians ?? [],
|
|
62
|
+
trustees: spec.trustees ?? [],
|
|
63
|
+
initialPasskeyCredentialIdDigest: spec.passkey?.credentialIdDigest ?? ZERO_BYTES32,
|
|
64
|
+
initialPasskeyX: spec.passkey?.x ?? 0n,
|
|
65
|
+
initialPasskeyY: spec.passkey?.y ?? 0n,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export class AgentAccountClient {
|
|
69
|
+
publicClient;
|
|
70
|
+
opts;
|
|
71
|
+
constructor(opts) {
|
|
72
|
+
this.opts = opts;
|
|
73
|
+
this.publicClient = createPublicClient({ transport: http(opts.rpcUrl) });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Deterministic CREATE2 address for any AgentAccount (any mode). Delegates
|
|
77
|
+
* to the factory's view so TS + Solidity stay in lock-step.
|
|
78
|
+
*/
|
|
79
|
+
async getAddressForAgentAccount(spec) {
|
|
80
|
+
const factory = getContract({
|
|
81
|
+
address: this.opts.factory,
|
|
82
|
+
abi: agentAccountFactoryAbi,
|
|
83
|
+
client: this.publicClient,
|
|
84
|
+
});
|
|
85
|
+
return (await factory.read.getAddressForAgentAccount([
|
|
86
|
+
_initParamsTuple(spec),
|
|
87
|
+
spec.salt,
|
|
88
|
+
]));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Deploy an AgentAccount via the factory using a raw bootstrap private key.
|
|
92
|
+
* Idempotent — skips the tx if the predicted address already has code.
|
|
93
|
+
* Prefer `createAgentAccountFromAccount` with a KMS-backed viem account
|
|
94
|
+
* in production (no private-key material in process memory).
|
|
95
|
+
*/
|
|
96
|
+
async createAgentAccountFromPrivateKey(spec, bootstrapPrivateKey) {
|
|
97
|
+
const account = privateKeyToAccount(bootstrapPrivateKey);
|
|
98
|
+
return this.createAgentAccountFromAccount(spec, account);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Deploy an AgentAccount via the factory using any viem-compatible account.
|
|
102
|
+
* The signer pays gas; the deployed account is custodian-of-spec, not
|
|
103
|
+
* custodian-of-relayer. Idempotent.
|
|
104
|
+
*/
|
|
105
|
+
async createAgentAccountFromAccount(spec,
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
account) {
|
|
108
|
+
const predicted = await this.getAddressForAgentAccount(spec);
|
|
109
|
+
if (await this.isDeployed(predicted))
|
|
110
|
+
return predicted;
|
|
111
|
+
const wallet = createWalletClient({ account, transport: http(this.opts.rpcUrl) });
|
|
112
|
+
const hash = await wallet.writeContract({
|
|
113
|
+
address: this.opts.factory,
|
|
114
|
+
abi: agentAccountFactoryAbi,
|
|
115
|
+
functionName: 'createAgentAccount',
|
|
116
|
+
args: [
|
|
117
|
+
_initParamsTuple(spec),
|
|
118
|
+
_timelockOverridesTuple(spec),
|
|
119
|
+
spec.salt,
|
|
120
|
+
],
|
|
121
|
+
account,
|
|
122
|
+
chain: null,
|
|
123
|
+
});
|
|
124
|
+
await this.publicClient.waitForTransactionReceipt({ hash });
|
|
125
|
+
return predicted;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* On-chain `isCustodian(addr)` query against a deployed AgentAccount.
|
|
129
|
+
* Returns the unified view (external custodians + passkey PIAs). Returns
|
|
130
|
+
* false if the account isn't deployed yet.
|
|
131
|
+
*/
|
|
132
|
+
async isCustodian(account, address) {
|
|
133
|
+
if (!(await this.isDeployed(account)))
|
|
134
|
+
return false;
|
|
135
|
+
try {
|
|
136
|
+
const acct = getContract({
|
|
137
|
+
address: account,
|
|
138
|
+
abi: agentAccountAbi,
|
|
139
|
+
client: this.publicClient,
|
|
140
|
+
});
|
|
141
|
+
return (await acct.read.isCustodian([address]));
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* On-chain `hasPasskey(credentialIdDigest)` — is this passkey CURRENTLY a
|
|
149
|
+
* registered credential of the account? (Passkeys are tracked by digest, not as
|
|
150
|
+
* an EOA custodian.) Returns false if the account isn't deployed yet.
|
|
151
|
+
*/
|
|
152
|
+
async hasPasskey(account, credentialIdDigest) {
|
|
153
|
+
if (!(await this.isDeployed(account)))
|
|
154
|
+
return false;
|
|
155
|
+
try {
|
|
156
|
+
const acct = getContract({ address: account, abi: agentAccountAbi, client: this.publicClient });
|
|
157
|
+
return (await acct.read.hasPasskey([credentialIdDigest]));
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/** On-chain count of EOA custodians (0 if not deployed). Lets a caller tell whether
|
|
164
|
+
* an account has wallet/EOA custody. */
|
|
165
|
+
async custodianCount(account) {
|
|
166
|
+
if (!(await this.isDeployed(account)))
|
|
167
|
+
return 0n;
|
|
168
|
+
try {
|
|
169
|
+
const acct = getContract({ address: account, abi: agentAccountAbi, client: this.publicClient });
|
|
170
|
+
return (await acct.read.custodianCount());
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return 0n;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** On-chain count of registered passkeys (0 if not deployed). Lets a caller tell
|
|
177
|
+
* whether an account has passkey custody. */
|
|
178
|
+
async passkeyCount(account) {
|
|
179
|
+
if (!(await this.isDeployed(account)))
|
|
180
|
+
return 0n;
|
|
181
|
+
try {
|
|
182
|
+
const acct = getContract({ address: account, abi: agentAccountAbi, client: this.publicClient });
|
|
183
|
+
return (await acct.read.passkeyCount());
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return 0n;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
async isDeployed(account) {
|
|
190
|
+
const code = await this.publicClient.getCode({ address: account });
|
|
191
|
+
return code !== undefined && code !== '0x' && code.length > 2;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Produce an ERC-1271-compatible signature: signer.signMessage of `hash`
|
|
195
|
+
* (as raw bytes). The deployed account's isValidSignature then validates
|
|
196
|
+
* by re-deriving EIP-191 digest and checking ownership.
|
|
197
|
+
*/
|
|
198
|
+
async signWithErc1271(account, hash, signer) {
|
|
199
|
+
void account; // signer's signature is what matters; account is for the verifier's lookup
|
|
200
|
+
return signer.signMessage({ raw: hash });
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Verify a signature against a deployed account via on-chain ERC-1271 call.
|
|
204
|
+
* Returns true iff `isValidSignature` returns the magic value 0x1626ba7e.
|
|
205
|
+
*/
|
|
206
|
+
async isValidSignature(account, hash, signature) {
|
|
207
|
+
try {
|
|
208
|
+
const account_ = getContract({
|
|
209
|
+
address: account,
|
|
210
|
+
abi: agentAccountAbi,
|
|
211
|
+
client: this.publicClient,
|
|
212
|
+
});
|
|
213
|
+
const result = (await account_.read.isValidSignature([hash, signature]));
|
|
214
|
+
return result === ERC1271_MAGIC_VALUE;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// If the call reverts (e.g., account not deployed yet), treat as invalid.
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Build an unsigned UserOp targeting an ALREADY-DEPLOYED AgentAccount.
|
|
223
|
+
* Counterpart to `buildDeployUserOpForAgentAccount` (which deploys the
|
|
224
|
+
* account); this is for calls AFTER deploy: addCustodian, addPasskey,
|
|
225
|
+
* validator.proposeAdmin, arbitrary execute(target, value, data), etc.
|
|
226
|
+
*
|
|
227
|
+
* @param opts.sender Existing AgentAccount address.
|
|
228
|
+
* @param opts.callData Calldata for the account's execute path. Typically
|
|
229
|
+
* built via viem's encodeFunctionData against
|
|
230
|
+
* agentAccountAbi.execute or the account's own
|
|
231
|
+
* per-action selectors.
|
|
232
|
+
* @param opts.paymaster Paymaster address (sponsors gas).
|
|
233
|
+
* @param opts.verifyingPaymaster When set, appends the EIP-191 paymaster
|
|
234
|
+
* signature to paymasterAndData (audit C2 mode).
|
|
235
|
+
*
|
|
236
|
+
* Returns { userOp, userOpHash, sender } — same shape as buildDeployUserOp.
|
|
237
|
+
* The caller signs userOpHash with their owner authority (EOA, passkey,
|
|
238
|
+
* or ERC-1271 contract sig) + drops the sig into userOp.signature, then
|
|
239
|
+
* passes the result to submitCallUserOp.
|
|
240
|
+
*/
|
|
241
|
+
async buildCallUserOp(opts) {
|
|
242
|
+
const bundler = new BundlerClient({
|
|
243
|
+
rpcUrl: this.opts.rpcUrl,
|
|
244
|
+
entryPoint: this.opts.entryPoint,
|
|
245
|
+
});
|
|
246
|
+
const nonce = await bundler.getNonce(opts.sender);
|
|
247
|
+
// Gas defaults sized for the WORST-case validateUserOp path: a WebAuthn
|
|
248
|
+
// signature verified by Daimo's pure-Solidity P-256 verifier (~330k gas
|
|
249
|
+
// plus sha256s + base64url decode + clientDataJSON parse). On chains with
|
|
250
|
+
// RIP-7212 deployed at 0x100 the precompile branch costs ~3.5k and the
|
|
251
|
+
// budget is wildly over-provisioned, which is fine.
|
|
252
|
+
//
|
|
253
|
+
// callGasLimit is sized for the most common heavy demo path: an Org or
|
|
254
|
+
// Treasury AgentAccount deploy dispatched as Account.execute(factory,
|
|
255
|
+
// 0, createAgentAccount(...)). Factory deploy + custody-policy install
|
|
256
|
+
// lands around 600-700k; 800k leaves headroom.
|
|
257
|
+
//
|
|
258
|
+
// Callers can override either via opts.verificationGasLimit /
|
|
259
|
+
// opts.callGasLimit if they know the call is cheaper (saves paymaster
|
|
260
|
+
// burn) or heavier.
|
|
261
|
+
const verificationGasLimit = opts.verificationGasLimit ?? 500000n;
|
|
262
|
+
const callGasLimit = opts.callGasLimit ?? 800000n;
|
|
263
|
+
const accountGasLimits = packGasLimits(verificationGasLimit, callGasLimit);
|
|
264
|
+
const preVerificationGas = opts.preVerificationGas ?? 60000n;
|
|
265
|
+
const block = await this.publicClient.getBlock();
|
|
266
|
+
const baseFeePerGas = block.baseFeePerGas ?? 100000000n;
|
|
267
|
+
const maxPriorityFeePerGas = 100000000n; // 0.1 gwei
|
|
268
|
+
const maxFeePerGas = baseFeePerGas + maxPriorityFeePerGas * 2n;
|
|
269
|
+
const gasFees = packGasLimits(maxPriorityFeePerGas, maxFeePerGas);
|
|
270
|
+
const pmVerifGas = opts.paymasterVerificationGasLimit ?? 50000n;
|
|
271
|
+
const pmPostOpGas = 0n;
|
|
272
|
+
const paymasterAndData = await buildPaymasterAndData({
|
|
273
|
+
paymaster: opts.paymaster,
|
|
274
|
+
pmVerifGas,
|
|
275
|
+
pmPostOpGas,
|
|
276
|
+
verifyingPaymaster: opts.verifyingPaymaster,
|
|
277
|
+
userOpFields: {
|
|
278
|
+
sender: opts.sender,
|
|
279
|
+
nonce,
|
|
280
|
+
initCode: '0x',
|
|
281
|
+
callData: opts.callData,
|
|
282
|
+
accountGasLimits,
|
|
283
|
+
preVerificationGas,
|
|
284
|
+
gasFees,
|
|
285
|
+
},
|
|
286
|
+
chainId: this.opts.chainId,
|
|
287
|
+
});
|
|
288
|
+
const userOp = {
|
|
289
|
+
sender: opts.sender,
|
|
290
|
+
nonce,
|
|
291
|
+
initCode: '0x',
|
|
292
|
+
callData: opts.callData,
|
|
293
|
+
accountGasLimits,
|
|
294
|
+
preVerificationGas,
|
|
295
|
+
gasFees,
|
|
296
|
+
paymasterAndData,
|
|
297
|
+
signature: '0x',
|
|
298
|
+
};
|
|
299
|
+
const userOpHash = await bundler.getUserOpHash(userOp);
|
|
300
|
+
return { userOp, userOpHash, sender: opts.sender };
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Backwards-compatible alias preserving the spec 201 `buildUserOp` shape.
|
|
304
|
+
* Wraps `buildCallUserOp` for single-call userOps. Multi-call (`account.executeBatch`)
|
|
305
|
+
* is the consumer's responsibility — encode the batch as callData and pass it in.
|
|
306
|
+
*/
|
|
307
|
+
async buildUserOp(params) {
|
|
308
|
+
if (params.calls.length === 0)
|
|
309
|
+
throw new Error('buildUserOp: at least one call required');
|
|
310
|
+
if (params.calls.length > 1) {
|
|
311
|
+
throw new Error('buildUserOp: multi-call not implemented in v0 — encode as account.executeBatch in callData');
|
|
312
|
+
}
|
|
313
|
+
const c = params.calls[0];
|
|
314
|
+
const callData = encodeFunctionData({
|
|
315
|
+
abi: [
|
|
316
|
+
{
|
|
317
|
+
type: 'function',
|
|
318
|
+
name: 'execute',
|
|
319
|
+
stateMutability: 'nonpayable',
|
|
320
|
+
inputs: [
|
|
321
|
+
{ name: 'target', type: 'address' },
|
|
322
|
+
{ name: 'value', type: 'uint256' },
|
|
323
|
+
{ name: 'data', type: 'bytes' },
|
|
324
|
+
],
|
|
325
|
+
outputs: [],
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
functionName: 'execute',
|
|
329
|
+
args: [c.to, c.value, c.data],
|
|
330
|
+
});
|
|
331
|
+
return this.buildCallUserOp({
|
|
332
|
+
sender: params.account,
|
|
333
|
+
callData,
|
|
334
|
+
paymaster: params.paymaster,
|
|
335
|
+
verifyingPaymaster: params.verifyingPaymaster,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Compute the canonical hash a verifying-paymaster signer must sign
|
|
340
|
+
* (audit C2). Matches `SmartAgentPaymaster.getHash(...)` on-chain.
|
|
341
|
+
* Returns the raw keccak256 — callers wrap with EIP-191 ("\\x19Ethereum
|
|
342
|
+
* Signed Message:\\n32" prefix) before signing, which is what
|
|
343
|
+
* `signMessage({ raw })` does by convention on the viem side.
|
|
344
|
+
*/
|
|
345
|
+
static computeVerifyingPaymasterHash(args) {
|
|
346
|
+
return keccak256(encodeAbiParameters([
|
|
347
|
+
{ type: 'address' }, // userOp.sender
|
|
348
|
+
{ type: 'uint256' }, // userOp.nonce
|
|
349
|
+
{ type: 'bytes32' }, // keccak256(userOp.initCode)
|
|
350
|
+
{ type: 'bytes32' }, // keccak256(userOp.callData)
|
|
351
|
+
{ type: 'bytes32' }, // userOp.accountGasLimits
|
|
352
|
+
{ type: 'uint256' }, // userOp.preVerificationGas
|
|
353
|
+
{ type: 'bytes32' }, // userOp.gasFees
|
|
354
|
+
{ type: 'uint256' }, // chainId
|
|
355
|
+
{ type: 'address' }, // paymaster
|
|
356
|
+
{ type: 'uint48' }, // validUntil
|
|
357
|
+
{ type: 'uint48' }, // validAfter
|
|
358
|
+
], [
|
|
359
|
+
args.userOp.sender,
|
|
360
|
+
args.userOp.nonce,
|
|
361
|
+
keccak256(args.userOp.initCode),
|
|
362
|
+
keccak256(args.userOp.callData),
|
|
363
|
+
args.userOp.accountGasLimits,
|
|
364
|
+
args.userOp.preVerificationGas,
|
|
365
|
+
args.userOp.gasFees,
|
|
366
|
+
BigInt(args.chainId),
|
|
367
|
+
args.paymaster,
|
|
368
|
+
args.validUntil,
|
|
369
|
+
args.validAfter,
|
|
370
|
+
]));
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Build an UNSIGNED ERC-4337 v0.9 UserOperation that deploys an
|
|
374
|
+
* AgentAccount via `factory.createAgentAccount(...)`. Works for any
|
|
375
|
+
* mode and signer shape — the signature on `userOpHash` uses whatever
|
|
376
|
+
* owner authority the resulting account will accept.
|
|
377
|
+
*
|
|
378
|
+
* Paymaster sponsorship: `paymasterAndData` is set to the configured
|
|
379
|
+
* paymaster. Pass `verifyingPaymaster.signFn` to opt into audit C2's
|
|
380
|
+
* verifying-paymaster signed-attestation mode.
|
|
381
|
+
*
|
|
382
|
+
* Gas defaults are sized for the worst-case validateUserOp path: a
|
|
383
|
+
* WebAuthn passkey-init account verified by Daimo's pure-Solidity P-256
|
|
384
|
+
* fallback (~350-400k) plus ERC1967Proxy deploy + storage writes
|
|
385
|
+
* (~300k) + (for mode>0) the CustodyPolicy install (~250k). Override via
|
|
386
|
+
* `verificationGasLimit` for cheaper paths.
|
|
387
|
+
*/
|
|
388
|
+
async buildDeployUserOpForAgentAccount(opts) {
|
|
389
|
+
const { spec, paymaster } = opts;
|
|
390
|
+
const sender = await this.getAddressForAgentAccount(spec);
|
|
391
|
+
const factoryCalldata = encodeFunctionData({
|
|
392
|
+
abi: agentAccountFactoryAbi,
|
|
393
|
+
functionName: 'createAgentAccount',
|
|
394
|
+
args: [
|
|
395
|
+
_initParamsTuple(spec),
|
|
396
|
+
_timelockOverridesTuple(spec),
|
|
397
|
+
spec.salt,
|
|
398
|
+
],
|
|
399
|
+
});
|
|
400
|
+
const initCode = (this.opts.factory + factoryCalldata.slice(2));
|
|
401
|
+
const deployCallData = opts.callData ?? '0x';
|
|
402
|
+
const verificationGasLimit = opts.verificationGasLimit ?? 1500000n;
|
|
403
|
+
// Deploy-only → 0; deploy+execute → enough to run the inner calls (default sized for a
|
|
404
|
+
// small batch like name register + set-primary).
|
|
405
|
+
const callGasLimit = opts.callGasLimit ?? (deployCallData !== '0x' ? 800000n : 0n);
|
|
406
|
+
const accountGasLimits = packGasLimits(verificationGasLimit, callGasLimit);
|
|
407
|
+
const preVerificationGas = opts.preVerificationGas ?? 60000n;
|
|
408
|
+
const block = await this.publicClient.getBlock();
|
|
409
|
+
const baseFeePerGas = block.baseFeePerGas ?? 100000000n;
|
|
410
|
+
const maxPriorityFeePerGas = 100000000n;
|
|
411
|
+
const maxFeePerGas = baseFeePerGas + maxPriorityFeePerGas * 2n;
|
|
412
|
+
const gasFees = packGasLimits(maxPriorityFeePerGas, maxFeePerGas);
|
|
413
|
+
const pmVerifGas = opts.paymasterVerificationGasLimit ?? 50000n;
|
|
414
|
+
const pmPostOpGas = 0n;
|
|
415
|
+
const paymasterAndData = await buildPaymasterAndData({
|
|
416
|
+
paymaster,
|
|
417
|
+
pmVerifGas,
|
|
418
|
+
pmPostOpGas,
|
|
419
|
+
verifyingPaymaster: opts.verifyingPaymaster,
|
|
420
|
+
userOpFields: { sender, nonce: 0n, initCode, callData: deployCallData, accountGasLimits, preVerificationGas, gasFees },
|
|
421
|
+
chainId: this.opts.chainId,
|
|
422
|
+
});
|
|
423
|
+
const userOp = {
|
|
424
|
+
sender,
|
|
425
|
+
nonce: 0n,
|
|
426
|
+
initCode,
|
|
427
|
+
callData: deployCallData,
|
|
428
|
+
accountGasLimits,
|
|
429
|
+
preVerificationGas,
|
|
430
|
+
gasFees,
|
|
431
|
+
paymasterAndData,
|
|
432
|
+
signature: '0x',
|
|
433
|
+
};
|
|
434
|
+
const bundler = new BundlerClient({
|
|
435
|
+
rpcUrl: this.opts.rpcUrl,
|
|
436
|
+
entryPoint: this.opts.entryPoint,
|
|
437
|
+
});
|
|
438
|
+
const userOpHash = await bundler.getUserOpHash(userOp);
|
|
439
|
+
return { userOp, userOpHash, sender };
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Submit a (now-signed) deploy UserOp via EntryPoint.handleOps. The
|
|
443
|
+
* `bundlerAccount` pays gas (will be reimbursed by the paymaster) and
|
|
444
|
+
* broadcasts the tx. In production this is `createKmsViemAccount(kms)`
|
|
445
|
+
* — no private key held locally.
|
|
446
|
+
*/
|
|
447
|
+
async submitDeployUserOp(userOp,
|
|
448
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
449
|
+
bundlerAccount) {
|
|
450
|
+
const bundler = new BundlerClient({
|
|
451
|
+
rpcUrl: this.opts.rpcUrl,
|
|
452
|
+
entryPoint: this.opts.entryPoint,
|
|
453
|
+
});
|
|
454
|
+
const receipt = await bundler.sendUserOps([userOp], bundlerAccount.address, bundlerAccount);
|
|
455
|
+
return { deployedAddress: userOp.sender, receipt };
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Submit a (signed) post-deploy UserOp via EntryPoint.handleOps. Counterpart
|
|
459
|
+
* to `submitDeployUserOp`. The relayer (bundlerAccount) pays gas; the
|
|
460
|
+
* paymaster reimburses the bundler from its EntryPoint deposit.
|
|
461
|
+
*/
|
|
462
|
+
async submitCallUserOp(userOp,
|
|
463
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
464
|
+
bundlerAccount) {
|
|
465
|
+
const bundler = new BundlerClient({
|
|
466
|
+
rpcUrl: this.opts.rpcUrl,
|
|
467
|
+
entryPoint: this.opts.entryPoint,
|
|
468
|
+
});
|
|
469
|
+
const receipt = await bundler.sendUserOps([userOp], bundlerAccount.address, bundlerAccount);
|
|
470
|
+
return { receipt };
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,oDAAoD;AACpD,EAAE;AACF,gEAAgE;AAChE,uEAAuE;AACvE,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,EACJ,SAAS,EACT,WAA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,CAAC,MAAM;YACxB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;SACjC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CACpB,MAA2B;IAC3B,8DAA8D;IAC9D,cAAmB;QAEnB,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC;YAChC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;YACxB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;SACjC,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC5F,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;CAEF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny helper: wrap a `{ to, value, data }` call into the encoded
|
|
3
|
+
* calldata for `AgentAccount.execute(target, value, data)`.
|
|
4
|
+
*
|
|
5
|
+
* This bridges the Phase-4 call builders in agent-naming /
|
|
6
|
+
* agent-relationships / agent-profile (which all return
|
|
7
|
+
* `{ to, value, data }`) to the user's AgentAccount execute path —
|
|
8
|
+
* the canonical way for a Smart Agent to dispatch ANY on-chain
|
|
9
|
+
* write through its custody-gated authority.
|
|
10
|
+
*
|
|
11
|
+
* The returned calldata is what the demo's `useGaslessTx` (and any
|
|
12
|
+
* other UserOp builder) passes as the `callData` field of the
|
|
13
|
+
* outer userOp. AgentAccount's validateUserOp + execute path then
|
|
14
|
+
* applies the user's signature path (WebAuthn / EOA / ERC-1271)
|
|
15
|
+
* before calling `target.call{value: value}(data)`.
|
|
16
|
+
*/
|
|
17
|
+
import { type Address, type Hex } from 'viem';
|
|
18
|
+
/** Minimal call-shape — matches the ContractCall type from other SDKs. */
|
|
19
|
+
export interface ContractCall {
|
|
20
|
+
to: Address;
|
|
21
|
+
value: bigint;
|
|
22
|
+
data: Hex;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Encode `AgentAccount.execute(target, value, data)` calldata around
|
|
26
|
+
* a single `ContractCall`. Pass the result as the `callData` field
|
|
27
|
+
* of a UserOp targeting the user's Smart Agent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildExecuteCallData(call: ContractCall): Hex;
|
|
30
|
+
/**
|
|
31
|
+
* Encode `AgentAccount.executeBatch(Call[])` calldata. All inner calls
|
|
32
|
+
* execute atomically in one transaction — any inner revert reverts the
|
|
33
|
+
* whole batch. Use this when two dependent calls (e.g. `register(name)`
|
|
34
|
+
* then `setPrimaryName(node)`) MUST land together to avoid an
|
|
35
|
+
* inter-userOp race against a bundler that may see a stale view of the
|
|
36
|
+
* first userOp's state.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildExecuteBatchCallData(calls: ContractCall[]): Hex;
|
|
39
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAgC,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAG5E,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,GAAG,CAM5D;AA2BD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,CAQpE"}
|
package/dist/execute.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny helper: wrap a `{ to, value, data }` call into the encoded
|
|
3
|
+
* calldata for `AgentAccount.execute(target, value, data)`.
|
|
4
|
+
*
|
|
5
|
+
* This bridges the Phase-4 call builders in agent-naming /
|
|
6
|
+
* agent-relationships / agent-profile (which all return
|
|
7
|
+
* `{ to, value, data }`) to the user's AgentAccount execute path —
|
|
8
|
+
* the canonical way for a Smart Agent to dispatch ANY on-chain
|
|
9
|
+
* write through its custody-gated authority.
|
|
10
|
+
*
|
|
11
|
+
* The returned calldata is what the demo's `useGaslessTx` (and any
|
|
12
|
+
* other UserOp builder) passes as the `callData` field of the
|
|
13
|
+
* outer userOp. AgentAccount's validateUserOp + execute path then
|
|
14
|
+
* applies the user's signature path (WebAuthn / EOA / ERC-1271)
|
|
15
|
+
* before calling `target.call{value: value}(data)`.
|
|
16
|
+
*/
|
|
17
|
+
import { encodeFunctionData } from 'viem';
|
|
18
|
+
import { agentAccountAbi } from './abis';
|
|
19
|
+
/**
|
|
20
|
+
* Encode `AgentAccount.execute(target, value, data)` calldata around
|
|
21
|
+
* a single `ContractCall`. Pass the result as the `callData` field
|
|
22
|
+
* of a UserOp targeting the user's Smart Agent.
|
|
23
|
+
*/
|
|
24
|
+
export function buildExecuteCallData(call) {
|
|
25
|
+
return encodeFunctionData({
|
|
26
|
+
abi: agentAccountAbi,
|
|
27
|
+
functionName: 'execute',
|
|
28
|
+
args: [call.to, call.value, call.data],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Minimal `executeBatch(Call[])` ABI fragment. Inlined so this helper
|
|
33
|
+
* doesn't depend on a specific generated ABI export. Matches
|
|
34
|
+
* `BaseAccount.Call` exactly: `(address target, uint256 value, bytes data)`.
|
|
35
|
+
*/
|
|
36
|
+
const EXECUTE_BATCH_ABI = [
|
|
37
|
+
{
|
|
38
|
+
type: 'function',
|
|
39
|
+
name: 'executeBatch',
|
|
40
|
+
stateMutability: 'nonpayable',
|
|
41
|
+
inputs: [
|
|
42
|
+
{
|
|
43
|
+
name: 'calls',
|
|
44
|
+
type: 'tuple[]',
|
|
45
|
+
components: [
|
|
46
|
+
{ name: 'target', type: 'address' },
|
|
47
|
+
{ name: 'value', type: 'uint256' },
|
|
48
|
+
{ name: 'data', type: 'bytes' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
outputs: [],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
/**
|
|
56
|
+
* Encode `AgentAccount.executeBatch(Call[])` calldata. All inner calls
|
|
57
|
+
* execute atomically in one transaction — any inner revert reverts the
|
|
58
|
+
* whole batch. Use this when two dependent calls (e.g. `register(name)`
|
|
59
|
+
* then `setPrimaryName(node)`) MUST land together to avoid an
|
|
60
|
+
* inter-userOp race against a bundler that may see a stale view of the
|
|
61
|
+
* first userOp's state.
|
|
62
|
+
*/
|
|
63
|
+
export function buildExecuteBatchCallData(calls) {
|
|
64
|
+
return encodeFunctionData({
|
|
65
|
+
abi: EXECUTE_BATCH_ABI,
|
|
66
|
+
functionName: 'executeBatch',
|
|
67
|
+
args: [
|
|
68
|
+
calls.map((c) => ({ target: c.to, value: c.value, data: c.data })),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAoC,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AASzC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAkB;IACrD,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,eAAe;QACpB,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC;KACvC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,iBAAiB,GAAG;IACxB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,cAAc;QACpB,eAAe,EAAE,YAAY;QAC7B,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE;oBACV,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;oBAClC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;iBAChC;aACF;SACF;QACD,OAAO,EAAE,EAAE;KACZ;CACqB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqB;IAC7D,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,iBAAiB;QACtB,YAAY,EAAE,cAAc;QAC5B,IAAI,EAAE;YACJ,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACnE;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AgentAccountClient } from './client';
|
|
2
|
+
export type { AgentAccountClientOpts, AgentAccountSpec } from './client';
|
|
3
|
+
export type { UserOperation, Address, Hex } from './types';
|
|
4
|
+
export { buildExecuteCallData, buildExecuteBatchCallData, type ContractCall } from './execute';
|
|
5
|
+
export { BundlerClient, packGasLimits, unpackGasLimits } from './bundler-client';
|
|
6
|
+
export type { BundlerClientOpts, PackedUserOperation } from './bundler-client';
|
|
7
|
+
export { agentAccountAbi, agentAccountFactoryAbi, approvedHashRegistryAbi, entryPointAbi, } from './abis';
|
|
8
|
+
export { packSafeSignatures, computeAdminPayloadHash, ADMIN_VERB_PROPOSE, ADMIN_VERB_EXECUTE, ADMIN_VERB_CANCEL, } from './quorum';
|
|
9
|
+
export type { SafeSignatureSlot } from './quorum';
|
|
10
|
+
export { SIG_TYPE_WEBAUTHN, encodeAssertion, encodeWebAuthnSignature, } from './webauthn-signature';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,QAAQ,CAAC;AAIhB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @agenticprimitives/agent-account — public API
|
|
2
|
+
//
|
|
3
|
+
// See ../../specs/201-agent-account.md for the full contract.
|
|
4
|
+
export { AgentAccountClient } from './client';
|
|
5
|
+
export { buildExecuteCallData, buildExecuteBatchCallData } from './execute';
|
|
6
|
+
export { BundlerClient, packGasLimits, unpackGasLimits } from './bundler-client';
|
|
7
|
+
export { agentAccountAbi, agentAccountFactoryAbi, approvedHashRegistryAbi, entryPointAbi, } from './abis';
|
|
8
|
+
// custodyPolicyAbi moved to @agenticprimitives/account-custody (spec 213 § 2.6).
|
|
9
|
+
// Spec 207 threshold-policy + quorum utilities (6c.3-c).
|
|
10
|
+
export { packSafeSignatures, computeAdminPayloadHash, ADMIN_VERB_PROPOSE, ADMIN_VERB_EXECUTE, ADMIN_VERB_CANCEL, } from './quorum';
|
|
11
|
+
// WebAuthn on-chain signature wire format (spec 130).
|
|
12
|
+
// The structured `WebAuthnAssertion` struct + WebAuthn ceremony live in
|
|
13
|
+
// the connect-auth package — agent-account only ships the on-chain
|
|
14
|
+
// encoder that turns the assertion into the byte layout
|
|
15
|
+
// `AgentAccount._validateSig` consumes.
|
|
16
|
+
export { SIG_TYPE_WEBAUTHN, encodeAssertion, encodeWebAuthnSignature, } from './webauthn-signature';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,MAAM,UAAU,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAqB,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,iFAAiF;AAEjF,yDAAyD;AACzD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAGlB,sDAAsD;AACtD,wEAAwE;AACxE,mEAAmE;AACnE,wDAAwD;AACxD,wCAAwC;AACxC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,uBAAuB,GACxB,MAAM,sBAAsB,CAAC"}
|