@agentic-trust/agentic-trust-sdk 1.0.43

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.
Files changed (78) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +213 -0
  3. package/abis/BaseRegistrarImplementation.json +1013 -0
  4. package/abis/ETHRegistrarController.json +1004 -0
  5. package/abis/IdentityRegistry.json +1044 -0
  6. package/abis/NameWrapper.json +2026 -0
  7. package/abis/PublicResolver.json +1772 -0
  8. package/abis/ReputationRegistry.json +701 -0
  9. package/abis/ValidationRegistry.json +505 -0
  10. package/dist/AIAgentAssociationClient.d.ts +58 -0
  11. package/dist/AIAgentAssociationClient.d.ts.map +1 -0
  12. package/dist/AIAgentAssociationClient.js +100 -0
  13. package/dist/AIAgentAssociationClient.js.map +1 -0
  14. package/dist/AIAgentDiscoveryClient.d.ts +673 -0
  15. package/dist/AIAgentDiscoveryClient.d.ts.map +1 -0
  16. package/dist/AIAgentDiscoveryClient.js +3184 -0
  17. package/dist/AIAgentDiscoveryClient.js.map +1 -0
  18. package/dist/AIAgentENSClient.d.ts +149 -0
  19. package/dist/AIAgentENSClient.d.ts.map +1 -0
  20. package/dist/AIAgentENSClient.js +958 -0
  21. package/dist/AIAgentENSClient.js.map +1 -0
  22. package/dist/AIAgentIdentityClient.d.ts +159 -0
  23. package/dist/AIAgentIdentityClient.d.ts.map +1 -0
  24. package/dist/AIAgentIdentityClient.js +660 -0
  25. package/dist/AIAgentIdentityClient.js.map +1 -0
  26. package/dist/AIAgentL2ENSDurenClient.d.ts +120 -0
  27. package/dist/AIAgentL2ENSDurenClient.d.ts.map +1 -0
  28. package/dist/AIAgentL2ENSDurenClient.js +735 -0
  29. package/dist/AIAgentL2ENSDurenClient.js.map +1 -0
  30. package/dist/AIAgentL2ENSNamespaceClient.d.ts +58 -0
  31. package/dist/AIAgentL2ENSNamespaceClient.d.ts.map +1 -0
  32. package/dist/AIAgentL2ENSNamespaceClient.js +214 -0
  33. package/dist/AIAgentL2ENSNamespaceClient.js.map +1 -0
  34. package/dist/AIAgentReputationClient.d.ts +69 -0
  35. package/dist/AIAgentReputationClient.d.ts.map +1 -0
  36. package/dist/AIAgentReputationClient.js +203 -0
  37. package/dist/AIAgentReputationClient.js.map +1 -0
  38. package/dist/AIAgentValidationClient.d.ts +60 -0
  39. package/dist/AIAgentValidationClient.d.ts.map +1 -0
  40. package/dist/AIAgentValidationClient.js +123 -0
  41. package/dist/AIAgentValidationClient.js.map +1 -0
  42. package/dist/OrgIdentityClient.d.ts +27 -0
  43. package/dist/OrgIdentityClient.d.ts.map +1 -0
  44. package/dist/OrgIdentityClient.js +169 -0
  45. package/dist/OrgIdentityClient.js.map +1 -0
  46. package/dist/abis/BaseRegistrarImplementation.json +1013 -0
  47. package/dist/abis/ETHRegistrarController.json +1004 -0
  48. package/dist/abis/IdentityRegistry.json +1044 -0
  49. package/dist/abis/NameWrapper.json +2026 -0
  50. package/dist/abis/PublicResolver.json +1772 -0
  51. package/dist/abis/ReputationRegistry.json +701 -0
  52. package/dist/abis/ValidationRegistry.json +505 -0
  53. package/dist/index.d.ts +25 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +24 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/schema.d.ts +13 -0
  58. package/dist/schema.d.ts.map +1 -0
  59. package/dist/schema.js +696 -0
  60. package/dist/schema.js.map +1 -0
  61. package/dist/schemaKb.d.ts +12 -0
  62. package/dist/schemaKb.d.ts.map +1 -0
  63. package/dist/schemaKb.js +593 -0
  64. package/dist/schemaKb.js.map +1 -0
  65. package/dist/tsconfig.tsbuildinfo +1 -0
  66. package/dist/utils/did8004.d.ts +57 -0
  67. package/dist/utils/did8004.d.ts.map +1 -0
  68. package/dist/utils/did8004.js +127 -0
  69. package/dist/utils/did8004.js.map +1 -0
  70. package/dist/utils/didEns.d.ts +46 -0
  71. package/dist/utils/didEns.d.ts.map +1 -0
  72. package/dist/utils/didEns.js +107 -0
  73. package/dist/utils/didEns.js.map +1 -0
  74. package/dist/utils/didEthr.d.ts +40 -0
  75. package/dist/utils/didEthr.d.ts.map +1 -0
  76. package/dist/utils/didEthr.js +87 -0
  77. package/dist/utils/didEthr.js.map +1 -0
  78. package/package.json +79 -0
@@ -0,0 +1,505 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "stateMutability": "nonpayable",
5
+ "type": "constructor"
6
+ },
7
+ {
8
+ "inputs": [
9
+ {
10
+ "internalType": "address",
11
+ "name": "target",
12
+ "type": "address"
13
+ }
14
+ ],
15
+ "name": "AddressEmptyCode",
16
+ "type": "error"
17
+ },
18
+ {
19
+ "inputs": [
20
+ {
21
+ "internalType": "address",
22
+ "name": "implementation",
23
+ "type": "address"
24
+ }
25
+ ],
26
+ "name": "ERC1967InvalidImplementation",
27
+ "type": "error"
28
+ },
29
+ {
30
+ "inputs": [],
31
+ "name": "ERC1967NonPayable",
32
+ "type": "error"
33
+ },
34
+ {
35
+ "inputs": [],
36
+ "name": "FailedCall",
37
+ "type": "error"
38
+ },
39
+ {
40
+ "inputs": [],
41
+ "name": "InvalidInitialization",
42
+ "type": "error"
43
+ },
44
+ {
45
+ "inputs": [],
46
+ "name": "NotInitializing",
47
+ "type": "error"
48
+ },
49
+ {
50
+ "inputs": [
51
+ {
52
+ "internalType": "address",
53
+ "name": "owner",
54
+ "type": "address"
55
+ }
56
+ ],
57
+ "name": "OwnableInvalidOwner",
58
+ "type": "error"
59
+ },
60
+ {
61
+ "inputs": [
62
+ {
63
+ "internalType": "address",
64
+ "name": "account",
65
+ "type": "address"
66
+ }
67
+ ],
68
+ "name": "OwnableUnauthorizedAccount",
69
+ "type": "error"
70
+ },
71
+ {
72
+ "inputs": [],
73
+ "name": "UUPSUnauthorizedCallContext",
74
+ "type": "error"
75
+ },
76
+ {
77
+ "inputs": [
78
+ {
79
+ "internalType": "bytes32",
80
+ "name": "slot",
81
+ "type": "bytes32"
82
+ }
83
+ ],
84
+ "name": "UUPSUnsupportedProxiableUUID",
85
+ "type": "error"
86
+ },
87
+ {
88
+ "anonymous": false,
89
+ "inputs": [
90
+ {
91
+ "indexed": false,
92
+ "internalType": "uint64",
93
+ "name": "version",
94
+ "type": "uint64"
95
+ }
96
+ ],
97
+ "name": "Initialized",
98
+ "type": "event"
99
+ },
100
+ {
101
+ "anonymous": false,
102
+ "inputs": [
103
+ {
104
+ "indexed": true,
105
+ "internalType": "address",
106
+ "name": "previousOwner",
107
+ "type": "address"
108
+ },
109
+ {
110
+ "indexed": true,
111
+ "internalType": "address",
112
+ "name": "newOwner",
113
+ "type": "address"
114
+ }
115
+ ],
116
+ "name": "OwnershipTransferred",
117
+ "type": "event"
118
+ },
119
+ {
120
+ "anonymous": false,
121
+ "inputs": [
122
+ {
123
+ "indexed": true,
124
+ "internalType": "address",
125
+ "name": "implementation",
126
+ "type": "address"
127
+ }
128
+ ],
129
+ "name": "Upgraded",
130
+ "type": "event"
131
+ },
132
+ {
133
+ "anonymous": false,
134
+ "inputs": [
135
+ {
136
+ "indexed": true,
137
+ "internalType": "address",
138
+ "name": "validatorAddress",
139
+ "type": "address"
140
+ },
141
+ {
142
+ "indexed": true,
143
+ "internalType": "uint256",
144
+ "name": "agentId",
145
+ "type": "uint256"
146
+ },
147
+ {
148
+ "indexed": false,
149
+ "internalType": "string",
150
+ "name": "requestURI",
151
+ "type": "string"
152
+ },
153
+ {
154
+ "indexed": true,
155
+ "internalType": "bytes32",
156
+ "name": "requestHash",
157
+ "type": "bytes32"
158
+ }
159
+ ],
160
+ "name": "ValidationRequest",
161
+ "type": "event"
162
+ },
163
+ {
164
+ "anonymous": false,
165
+ "inputs": [
166
+ {
167
+ "indexed": true,
168
+ "internalType": "address",
169
+ "name": "validatorAddress",
170
+ "type": "address"
171
+ },
172
+ {
173
+ "indexed": true,
174
+ "internalType": "uint256",
175
+ "name": "agentId",
176
+ "type": "uint256"
177
+ },
178
+ {
179
+ "indexed": true,
180
+ "internalType": "bytes32",
181
+ "name": "requestHash",
182
+ "type": "bytes32"
183
+ },
184
+ {
185
+ "indexed": false,
186
+ "internalType": "uint8",
187
+ "name": "response",
188
+ "type": "uint8"
189
+ },
190
+ {
191
+ "indexed": false,
192
+ "internalType": "string",
193
+ "name": "responseURI",
194
+ "type": "string"
195
+ },
196
+ {
197
+ "indexed": false,
198
+ "internalType": "bytes32",
199
+ "name": "responseHash",
200
+ "type": "bytes32"
201
+ },
202
+ {
203
+ "indexed": false,
204
+ "internalType": "string",
205
+ "name": "tag",
206
+ "type": "string"
207
+ }
208
+ ],
209
+ "name": "ValidationResponse",
210
+ "type": "event"
211
+ },
212
+ {
213
+ "inputs": [],
214
+ "name": "UPGRADE_INTERFACE_VERSION",
215
+ "outputs": [
216
+ {
217
+ "internalType": "string",
218
+ "name": "",
219
+ "type": "string"
220
+ }
221
+ ],
222
+ "stateMutability": "view",
223
+ "type": "function"
224
+ },
225
+ {
226
+ "inputs": [
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "agentId",
230
+ "type": "uint256"
231
+ }
232
+ ],
233
+ "name": "getAgentValidations",
234
+ "outputs": [
235
+ {
236
+ "internalType": "bytes32[]",
237
+ "name": "",
238
+ "type": "bytes32[]"
239
+ }
240
+ ],
241
+ "stateMutability": "view",
242
+ "type": "function"
243
+ },
244
+ {
245
+ "inputs": [],
246
+ "name": "getIdentityRegistry",
247
+ "outputs": [
248
+ {
249
+ "internalType": "address",
250
+ "name": "",
251
+ "type": "address"
252
+ }
253
+ ],
254
+ "stateMutability": "view",
255
+ "type": "function"
256
+ },
257
+ {
258
+ "inputs": [
259
+ {
260
+ "internalType": "uint256",
261
+ "name": "agentId",
262
+ "type": "uint256"
263
+ },
264
+ {
265
+ "internalType": "address[]",
266
+ "name": "validatorAddresses",
267
+ "type": "address[]"
268
+ },
269
+ {
270
+ "internalType": "string",
271
+ "name": "tag",
272
+ "type": "string"
273
+ }
274
+ ],
275
+ "name": "getSummary",
276
+ "outputs": [
277
+ {
278
+ "internalType": "uint64",
279
+ "name": "count",
280
+ "type": "uint64"
281
+ },
282
+ {
283
+ "internalType": "uint8",
284
+ "name": "avgResponse",
285
+ "type": "uint8"
286
+ }
287
+ ],
288
+ "stateMutability": "view",
289
+ "type": "function"
290
+ },
291
+ {
292
+ "inputs": [
293
+ {
294
+ "internalType": "bytes32",
295
+ "name": "requestHash",
296
+ "type": "bytes32"
297
+ }
298
+ ],
299
+ "name": "getValidationStatus",
300
+ "outputs": [
301
+ {
302
+ "internalType": "address",
303
+ "name": "validatorAddress",
304
+ "type": "address"
305
+ },
306
+ {
307
+ "internalType": "uint256",
308
+ "name": "agentId",
309
+ "type": "uint256"
310
+ },
311
+ {
312
+ "internalType": "uint8",
313
+ "name": "response",
314
+ "type": "uint8"
315
+ },
316
+ {
317
+ "internalType": "bytes32",
318
+ "name": "responseHash",
319
+ "type": "bytes32"
320
+ },
321
+ {
322
+ "internalType": "string",
323
+ "name": "tag",
324
+ "type": "string"
325
+ },
326
+ {
327
+ "internalType": "uint256",
328
+ "name": "lastUpdate",
329
+ "type": "uint256"
330
+ }
331
+ ],
332
+ "stateMutability": "view",
333
+ "type": "function"
334
+ },
335
+ {
336
+ "inputs": [
337
+ {
338
+ "internalType": "address",
339
+ "name": "validatorAddress",
340
+ "type": "address"
341
+ }
342
+ ],
343
+ "name": "getValidatorRequests",
344
+ "outputs": [
345
+ {
346
+ "internalType": "bytes32[]",
347
+ "name": "",
348
+ "type": "bytes32[]"
349
+ }
350
+ ],
351
+ "stateMutability": "view",
352
+ "type": "function"
353
+ },
354
+ {
355
+ "inputs": [],
356
+ "name": "getVersion",
357
+ "outputs": [
358
+ {
359
+ "internalType": "string",
360
+ "name": "",
361
+ "type": "string"
362
+ }
363
+ ],
364
+ "stateMutability": "pure",
365
+ "type": "function"
366
+ },
367
+ {
368
+ "inputs": [
369
+ {
370
+ "internalType": "address",
371
+ "name": "identityRegistry_",
372
+ "type": "address"
373
+ }
374
+ ],
375
+ "name": "initialize",
376
+ "outputs": [],
377
+ "stateMutability": "nonpayable",
378
+ "type": "function"
379
+ },
380
+ {
381
+ "inputs": [],
382
+ "name": "owner",
383
+ "outputs": [
384
+ {
385
+ "internalType": "address",
386
+ "name": "",
387
+ "type": "address"
388
+ }
389
+ ],
390
+ "stateMutability": "view",
391
+ "type": "function"
392
+ },
393
+ {
394
+ "inputs": [],
395
+ "name": "proxiableUUID",
396
+ "outputs": [
397
+ {
398
+ "internalType": "bytes32",
399
+ "name": "",
400
+ "type": "bytes32"
401
+ }
402
+ ],
403
+ "stateMutability": "view",
404
+ "type": "function"
405
+ },
406
+ {
407
+ "inputs": [],
408
+ "name": "renounceOwnership",
409
+ "outputs": [],
410
+ "stateMutability": "nonpayable",
411
+ "type": "function"
412
+ },
413
+ {
414
+ "inputs": [
415
+ {
416
+ "internalType": "address",
417
+ "name": "newOwner",
418
+ "type": "address"
419
+ }
420
+ ],
421
+ "name": "transferOwnership",
422
+ "outputs": [],
423
+ "stateMutability": "nonpayable",
424
+ "type": "function"
425
+ },
426
+ {
427
+ "inputs": [
428
+ {
429
+ "internalType": "address",
430
+ "name": "newImplementation",
431
+ "type": "address"
432
+ },
433
+ {
434
+ "internalType": "bytes",
435
+ "name": "data",
436
+ "type": "bytes"
437
+ }
438
+ ],
439
+ "name": "upgradeToAndCall",
440
+ "outputs": [],
441
+ "stateMutability": "payable",
442
+ "type": "function"
443
+ },
444
+ {
445
+ "inputs": [
446
+ {
447
+ "internalType": "address",
448
+ "name": "validatorAddress",
449
+ "type": "address"
450
+ },
451
+ {
452
+ "internalType": "uint256",
453
+ "name": "agentId",
454
+ "type": "uint256"
455
+ },
456
+ {
457
+ "internalType": "string",
458
+ "name": "requestURI",
459
+ "type": "string"
460
+ },
461
+ {
462
+ "internalType": "bytes32",
463
+ "name": "requestHash",
464
+ "type": "bytes32"
465
+ }
466
+ ],
467
+ "name": "validationRequest",
468
+ "outputs": [],
469
+ "stateMutability": "nonpayable",
470
+ "type": "function"
471
+ },
472
+ {
473
+ "inputs": [
474
+ {
475
+ "internalType": "bytes32",
476
+ "name": "requestHash",
477
+ "type": "bytes32"
478
+ },
479
+ {
480
+ "internalType": "uint8",
481
+ "name": "response",
482
+ "type": "uint8"
483
+ },
484
+ {
485
+ "internalType": "string",
486
+ "name": "responseURI",
487
+ "type": "string"
488
+ },
489
+ {
490
+ "internalType": "bytes32",
491
+ "name": "responseHash",
492
+ "type": "bytes32"
493
+ },
494
+ {
495
+ "internalType": "string",
496
+ "name": "tag",
497
+ "type": "string"
498
+ }
499
+ ],
500
+ "name": "validationResponse",
501
+ "outputs": [],
502
+ "stateMutability": "nonpayable",
503
+ "type": "function"
504
+ }
505
+ ]
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Agentic Trust SDK - Association Client
3
+ * Extends AssociationsStoreClient with AccountProvider support.
4
+ * Uses AccountProvider (Ports & Adapters pattern) for chain I/O.
5
+ */
6
+ import type { AccountProvider } from '@agentic-trust/8004-sdk';
7
+ import type { SignedAssociationRecord } from '@agentic-trust/8092-sdk';
8
+ import type { TxRequest } from '@agentic-trust/8004-sdk';
9
+ export declare class AIAgentAssociationClient {
10
+ private chain;
11
+ private accountProvider;
12
+ private associationsProxyAddress;
13
+ private baseClient;
14
+ constructor(accountProvider: AccountProvider, associationsProxyAddress: `0x${string}`);
15
+ private getBaseClient;
16
+ static create(accountProvider: AccountProvider, associationsProxyAddress: `0x${string}`): Promise<AIAgentAssociationClient>;
17
+ /**
18
+ * Get associations for an account (read-only, uses base client)
19
+ */
20
+ getAssociationsForEvmAccount(params: {
21
+ chainId: number;
22
+ accountAddress: string;
23
+ }): Promise<{
24
+ account: string;
25
+ chainId: number;
26
+ associations: any[];
27
+ }>;
28
+ /**
29
+ * Get the full SignedAssociationRecords (SARs) for an account (read-only).
30
+ * This exposes initiator/approver key types, signatures, interfaceId, and data.
31
+ */
32
+ getSignedAssociationsForEvmAccount(params: {
33
+ chainId: number;
34
+ accountAddress: string;
35
+ }): Promise<{
36
+ account: string;
37
+ chainId: number;
38
+ sars: any[];
39
+ }>;
40
+ /**
41
+ * Prepare the storeAssociation transaction data without sending it.
42
+ * This encodes the transaction that can be sent via a bundler using account abstraction.
43
+ */
44
+ prepareStoreAssociationTx(params: {
45
+ sar: SignedAssociationRecord;
46
+ }): Promise<{
47
+ txRequest: TxRequest;
48
+ }>;
49
+ /**
50
+ * Store association (write operation - requires wallet)
51
+ * This is a convenience method, but for AA we should use prepareStoreAssociationTx + client-side execution
52
+ */
53
+ storeAssociation(sar: SignedAssociationRecord): Promise<{
54
+ hash: string;
55
+ txHash: string;
56
+ }>;
57
+ }
58
+ //# sourceMappingURL=AIAgentAssociationClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIAgentAssociationClient.d.ts","sourceRoot":"","sources":["../AIAgentAssociationClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAY/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,qBAAa,wBAAwB;IACnC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,wBAAwB,CAAgB;IAChD,OAAO,CAAC,UAAU,CAAiC;gBAGjD,eAAe,EAAE,eAAe,EAChC,wBAAwB,EAAE,KAAK,MAAM,EAAE;YAY3B,aAAa;WAgBd,MAAM,CACjB,eAAe,EAAE,eAAe,EAChC,wBAAwB,EAAE,KAAK,MAAM,EAAE,GACtC,OAAO,CAAC,wBAAwB,CAAC;IAIpC;;OAEG;IACG,4BAA4B,CAAC,MAAM,EAAE;QACzC,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAKtE;;;OAGG;IACG,kCAAkC,CAAC,MAAM,EAAE;QAC/C,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAM9D;;;OAGG;IACG,yBAAyB,CAAC,MAAM,EAAE;QACtC,GAAG,EAAE,uBAAuB,CAAC;KAC9B,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC;IAqBrC;;;OAGG;IACG,gBAAgB,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAchG"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Agentic Trust SDK - Association Client
3
+ * Extends AssociationsStoreClient with AccountProvider support.
4
+ * Uses AccountProvider (Ports & Adapters pattern) for chain I/O.
5
+ */
6
+ import { sepolia } from 'viem/chains';
7
+ import { parseAbi } from 'viem';
8
+ import { AssociationsStoreClient } from '@agentic-trust/8092-sdk';
9
+ // Import ABI - need to handle the export structure
10
+ // The abi.ts file exports ASSOCIATIONS_STORE_ABI as const array
11
+ const ASSOCIATIONS_STORE_ABI = parseAbi([
12
+ "function storeAssociation((uint40 revokedAt,bytes2 initiatorKeyType,bytes2 approverKeyType,bytes initiatorSignature,bytes approverSignature,(bytes initiator,bytes approver,uint40 validAt,uint40 validUntil,bytes4 interfaceId,bytes data) record) sar)",
13
+ "function revokeAssociation(bytes32 associationId, uint40 revokedAt)",
14
+ "function getAssociationsForAccount(bytes account) view returns ((uint40 revokedAt,bytes2 initiatorKeyType,bytes2 approverKeyType,bytes initiatorSignature,bytes approverSignature,(bytes initiator,bytes approver,uint40 validAt,uint40 validUntil,bytes4 interfaceId,bytes data) record)[] sars)",
15
+ ]);
16
+ export class AIAgentAssociationClient {
17
+ chain;
18
+ accountProvider;
19
+ associationsProxyAddress;
20
+ baseClient;
21
+ constructor(accountProvider, associationsProxyAddress) {
22
+ this.accountProvider = accountProvider;
23
+ this.associationsProxyAddress = associationsProxyAddress;
24
+ this.chain = sepolia; // Default, can be overridden based on chainId
25
+ // Create base client for read operations using ethers provider
26
+ // Note: For write operations, we'll use AccountProvider via prepareStoreAssociationTx
27
+ // We'll initialize baseClient lazily when needed since we can't use await in constructor
28
+ this.baseClient = null; // Will be initialized in getAssociationsForEvmAccount
29
+ }
30
+ async getBaseClient() {
31
+ if (this.baseClient)
32
+ return this.baseClient;
33
+ const chainConfig = this.accountProvider.chain();
34
+ const rpcUrl = chainConfig.rpcUrl;
35
+ // Use dynamic import for ethers
36
+ const ethers = await import('ethers');
37
+ const provider = new ethers.JsonRpcProvider(rpcUrl);
38
+ this.baseClient = new AssociationsStoreClient(this.associationsProxyAddress, provider);
39
+ return this.baseClient;
40
+ }
41
+ // Factory helper to mirror other client create-style APIs
42
+ static async create(accountProvider, associationsProxyAddress) {
43
+ return new AIAgentAssociationClient(accountProvider, associationsProxyAddress);
44
+ }
45
+ /**
46
+ * Get associations for an account (read-only, uses base client)
47
+ */
48
+ async getAssociationsForEvmAccount(params) {
49
+ const client = await this.getBaseClient();
50
+ return client.getAssociationsForEvmAccount(params);
51
+ }
52
+ /**
53
+ * Get the full SignedAssociationRecords (SARs) for an account (read-only).
54
+ * This exposes initiator/approver key types, signatures, interfaceId, and data.
55
+ */
56
+ async getSignedAssociationsForEvmAccount(params) {
57
+ const client = await this.getBaseClient();
58
+ // Method is provided by @agentic-trust/8092-sdk AssociationsStoreClient
59
+ return client.getSignedAssociationsForEvmAccount(params);
60
+ }
61
+ /**
62
+ * Prepare the storeAssociation transaction data without sending it.
63
+ * This encodes the transaction that can be sent via a bundler using account abstraction.
64
+ */
65
+ async prepareStoreAssociationTx(params) {
66
+ if (!params.sar) {
67
+ throw new Error('sar (SignedAssociationRecord) is required');
68
+ }
69
+ // Encode the storeAssociation call
70
+ const data = await this.accountProvider?.encodeFunctionData({
71
+ abi: ASSOCIATIONS_STORE_ABI,
72
+ functionName: 'storeAssociation',
73
+ args: [params.sar],
74
+ });
75
+ return {
76
+ txRequest: {
77
+ to: this.associationsProxyAddress,
78
+ data: data || '0x',
79
+ value: 0n,
80
+ },
81
+ };
82
+ }
83
+ /**
84
+ * Store association (write operation - requires wallet)
85
+ * This is a convenience method, but for AA we should use prepareStoreAssociationTx + client-side execution
86
+ */
87
+ async storeAssociation(sar) {
88
+ const { txRequest } = await this.prepareStoreAssociationTx({ sar });
89
+ const result = await this.accountProvider?.send({
90
+ to: txRequest.to,
91
+ data: txRequest.data,
92
+ value: txRequest.value,
93
+ });
94
+ return {
95
+ hash: result?.hash || '',
96
+ txHash: result?.hash || '',
97
+ };
98
+ }
99
+ }
100
+ //# sourceMappingURL=AIAgentAssociationClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIAgentAssociationClient.js","sourceRoot":"","sources":["../AIAgentAssociationClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,mDAAmD;AACnD,gEAAgE;AAChE,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IACtC,0PAA0P;IAC1P,qEAAqE;IACrE,mSAAmS;CACpS,CAAC,CAAC;AAIH,MAAM,OAAO,wBAAwB;IAC3B,KAAK,CAAQ;IACb,eAAe,CAAkB;IACjC,wBAAwB,CAAgB;IACxC,UAAU,CAAiC;IAEnD,YACE,eAAgC,EAChC,wBAAuC;QAEvC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;QACzD,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