@inkd/sdk 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +288 -0
  2. package/dist/InkdClient.d.ts +89 -0
  3. package/dist/InkdClient.d.ts.map +1 -0
  4. package/dist/InkdClient.js +398 -0
  5. package/dist/InkdClient.js.map +1 -0
  6. package/dist/ProjectRegistry.d.ts +655 -0
  7. package/dist/ProjectRegistry.d.ts.map +1 -0
  8. package/dist/ProjectRegistry.js +708 -0
  9. package/dist/ProjectRegistry.js.map +1 -0
  10. package/dist/__tests__/InkdClient.advanced.test.d.ts +10 -0
  11. package/dist/__tests__/InkdClient.advanced.test.d.ts.map +1 -0
  12. package/dist/__tests__/InkdClient.advanced.test.js +588 -0
  13. package/dist/__tests__/InkdClient.advanced.test.js.map +1 -0
  14. package/dist/__tests__/InkdClient.connectArweave.test.d.ts +10 -0
  15. package/dist/__tests__/InkdClient.connectArweave.test.d.ts.map +1 -0
  16. package/dist/__tests__/InkdClient.connectArweave.test.js +132 -0
  17. package/dist/__tests__/InkdClient.connectArweave.test.js.map +1 -0
  18. package/dist/__tests__/InkdClient.test.d.ts +2 -0
  19. package/dist/__tests__/InkdClient.test.d.ts.map +1 -0
  20. package/dist/__tests__/InkdClient.test.js +259 -0
  21. package/dist/__tests__/InkdClient.test.js.map +1 -0
  22. package/dist/__tests__/ProjectRegistry.test.d.ts +8 -0
  23. package/dist/__tests__/ProjectRegistry.test.d.ts.map +1 -0
  24. package/dist/__tests__/ProjectRegistry.test.js +689 -0
  25. package/dist/__tests__/ProjectRegistry.test.js.map +1 -0
  26. package/dist/__tests__/arweave.test.d.ts +9 -0
  27. package/dist/__tests__/arweave.test.d.ts.map +1 -0
  28. package/dist/__tests__/arweave.test.js +353 -0
  29. package/dist/__tests__/arweave.test.js.map +1 -0
  30. package/dist/__tests__/encryption.test.d.ts +2 -0
  31. package/dist/__tests__/encryption.test.d.ts.map +1 -0
  32. package/dist/__tests__/encryption.test.js +154 -0
  33. package/dist/__tests__/encryption.test.js.map +1 -0
  34. package/dist/__tests__/errors.test.d.ts +2 -0
  35. package/dist/__tests__/errors.test.d.ts.map +1 -0
  36. package/dist/__tests__/errors.test.js +136 -0
  37. package/dist/__tests__/errors.test.js.map +1 -0
  38. package/dist/__tests__/events.test.d.ts +10 -0
  39. package/dist/__tests__/events.test.d.ts.map +1 -0
  40. package/dist/__tests__/events.test.js +380 -0
  41. package/dist/__tests__/events.test.js.map +1 -0
  42. package/dist/__tests__/index.InkdClient.test.d.ts +8 -0
  43. package/dist/__tests__/index.InkdClient.test.d.ts.map +1 -0
  44. package/dist/__tests__/index.InkdClient.test.js +422 -0
  45. package/dist/__tests__/index.InkdClient.test.js.map +1 -0
  46. package/dist/__tests__/multicall.test.d.ts +9 -0
  47. package/dist/__tests__/multicall.test.d.ts.map +1 -0
  48. package/dist/__tests__/multicall.test.js +362 -0
  49. package/dist/__tests__/multicall.test.js.map +1 -0
  50. package/dist/__tests__/types.test.d.ts +2 -0
  51. package/dist/__tests__/types.test.d.ts.map +1 -0
  52. package/dist/__tests__/types.test.js +35 -0
  53. package/dist/__tests__/types.test.js.map +1 -0
  54. package/dist/abi.d.ts +2632 -0
  55. package/dist/abi.d.ts.map +1 -0
  56. package/dist/abi.js +3423 -0
  57. package/dist/abi.js.map +1 -0
  58. package/dist/arweave.d.ts +45 -0
  59. package/dist/arweave.d.ts.map +1 -0
  60. package/dist/arweave.js +154 -0
  61. package/dist/arweave.js.map +1 -0
  62. package/dist/encryption.d.ts +52 -0
  63. package/dist/encryption.d.ts.map +1 -0
  64. package/dist/encryption.js +80 -0
  65. package/dist/encryption.js.map +1 -0
  66. package/dist/errors.d.ts +63 -0
  67. package/dist/errors.d.ts.map +1 -0
  68. package/dist/errors.js +124 -0
  69. package/dist/errors.js.map +1 -0
  70. package/dist/events.d.ts +136 -0
  71. package/dist/events.d.ts.map +1 -0
  72. package/dist/events.js +131 -0
  73. package/dist/events.js.map +1 -0
  74. package/dist/hooks/index.d.ts +5 -0
  75. package/dist/hooks/index.d.ts.map +1 -0
  76. package/dist/hooks/index.js +12 -0
  77. package/dist/hooks/index.js.map +1 -0
  78. package/dist/hooks/useInkd.d.ts +24 -0
  79. package/dist/hooks/useInkd.d.ts.map +1 -0
  80. package/dist/hooks/useInkd.js +109 -0
  81. package/dist/hooks/useInkd.js.map +1 -0
  82. package/dist/hooks/useInkdHolder.d.ts +16 -0
  83. package/dist/hooks/useInkdHolder.d.ts.map +1 -0
  84. package/dist/hooks/useInkdHolder.js +45 -0
  85. package/dist/hooks/useInkdHolder.js.map +1 -0
  86. package/dist/hooks/useInscriptions.d.ts +17 -0
  87. package/dist/hooks/useInscriptions.d.ts.map +1 -0
  88. package/dist/hooks/useInscriptions.js +46 -0
  89. package/dist/hooks/useInscriptions.js.map +1 -0
  90. package/dist/hooks/useToken.d.ts +16 -0
  91. package/dist/hooks/useToken.d.ts.map +1 -0
  92. package/dist/hooks/useToken.js +45 -0
  93. package/dist/hooks/useToken.js.map +1 -0
  94. package/dist/index.d.ts +54 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.js +290 -0
  97. package/dist/index.js.map +1 -0
  98. package/dist/multicall.d.ts +134 -0
  99. package/dist/multicall.d.ts.map +1 -0
  100. package/dist/multicall.js +182 -0
  101. package/dist/multicall.js.map +1 -0
  102. package/dist/types.d.ts +187 -0
  103. package/dist/types.d.ts.map +1 -0
  104. package/dist/types.js +32 -0
  105. package/dist/types.js.map +1 -0
  106. package/package.json +78 -0
@@ -0,0 +1,655 @@
1
+ /**
2
+ * @file ProjectRegistry.ts
3
+ * @description TypeScript client for InkdRegistry.sol — the core project registry contract.
4
+ * Use this module to create projects, push versions, manage collaborators,
5
+ * and transfer ownership on-chain.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { ProjectRegistry } from "@inkd/sdk";
10
+ * import { createWalletClient, createPublicClient, http } from "viem";
11
+ * import { base } from "viem/chains";
12
+ *
13
+ * const registry = new ProjectRegistry({
14
+ * registryAddress: "0x...",
15
+ * tokenAddress: "0x...",
16
+ * chainId: 8453,
17
+ * });
18
+ *
19
+ * registry.connect(walletClient, publicClient);
20
+ *
21
+ * // Create a project (locks 1 $INKD)
22
+ * const { projectId } = await registry.createProject({
23
+ * name: "my-agent-brain",
24
+ * description: "Persistent memory store for AI agent",
25
+ * license: "MIT",
26
+ * isPublic: true,
27
+ * isAgent: true,
28
+ * agentEndpoint: "https://api.myagent.xyz",
29
+ * });
30
+ *
31
+ * // Push a version
32
+ * await registry.pushVersion({
33
+ * projectId,
34
+ * arweaveHash: "ar://your-file-hash",
35
+ * versionTag: "v1.0.0",
36
+ * changelog: "Initial release",
37
+ * });
38
+ * ```
39
+ */
40
+ import type { PublicClient, WalletClient, Account, Chain, Transport } from "viem";
41
+ /** Minimal ABI fragment for InkdRegistry.sol */
42
+ export declare const INKD_REGISTRY_ABI: readonly [{
43
+ readonly type: "function";
44
+ readonly name: "projectCount";
45
+ readonly inputs: readonly [];
46
+ readonly outputs: readonly [{
47
+ readonly name: "";
48
+ readonly type: "uint256";
49
+ }];
50
+ readonly stateMutability: "view";
51
+ }, {
52
+ readonly type: "function";
53
+ readonly name: "versionFee";
54
+ readonly inputs: readonly [];
55
+ readonly outputs: readonly [{
56
+ readonly name: "";
57
+ readonly type: "uint256";
58
+ }];
59
+ readonly stateMutability: "view";
60
+ }, {
61
+ readonly type: "function";
62
+ readonly name: "transferFee";
63
+ readonly inputs: readonly [];
64
+ readonly outputs: readonly [{
65
+ readonly name: "";
66
+ readonly type: "uint256";
67
+ }];
68
+ readonly stateMutability: "view";
69
+ }, {
70
+ readonly type: "function";
71
+ readonly name: "TOKEN_LOCK_AMOUNT";
72
+ readonly inputs: readonly [];
73
+ readonly outputs: readonly [{
74
+ readonly name: "";
75
+ readonly type: "uint256";
76
+ }];
77
+ readonly stateMutability: "view";
78
+ }, {
79
+ readonly type: "function";
80
+ readonly name: "getProject";
81
+ readonly inputs: readonly [{
82
+ readonly name: "projectId";
83
+ readonly type: "uint256";
84
+ }];
85
+ readonly outputs: readonly [{
86
+ readonly name: "";
87
+ readonly type: "tuple";
88
+ readonly components: readonly [{
89
+ readonly name: "id";
90
+ readonly type: "uint256";
91
+ }, {
92
+ readonly name: "name";
93
+ readonly type: "string";
94
+ }, {
95
+ readonly name: "description";
96
+ readonly type: "string";
97
+ }, {
98
+ readonly name: "license";
99
+ readonly type: "string";
100
+ }, {
101
+ readonly name: "readmeHash";
102
+ readonly type: "string";
103
+ }, {
104
+ readonly name: "owner";
105
+ readonly type: "address";
106
+ }, {
107
+ readonly name: "isPublic";
108
+ readonly type: "bool";
109
+ }, {
110
+ readonly name: "isAgent";
111
+ readonly type: "bool";
112
+ }, {
113
+ readonly name: "agentEndpoint";
114
+ readonly type: "string";
115
+ }, {
116
+ readonly name: "createdAt";
117
+ readonly type: "uint256";
118
+ }, {
119
+ readonly name: "versionCount";
120
+ readonly type: "uint256";
121
+ }, {
122
+ readonly name: "exists";
123
+ readonly type: "bool";
124
+ }];
125
+ }];
126
+ readonly stateMutability: "view";
127
+ }, {
128
+ readonly type: "function";
129
+ readonly name: "getVersion";
130
+ readonly inputs: readonly [{
131
+ readonly name: "projectId";
132
+ readonly type: "uint256";
133
+ }, {
134
+ readonly name: "versionIndex";
135
+ readonly type: "uint256";
136
+ }];
137
+ readonly outputs: readonly [{
138
+ readonly name: "";
139
+ readonly type: "tuple";
140
+ readonly components: readonly [{
141
+ readonly name: "projectId";
142
+ readonly type: "uint256";
143
+ }, {
144
+ readonly name: "arweaveHash";
145
+ readonly type: "string";
146
+ }, {
147
+ readonly name: "versionTag";
148
+ readonly type: "string";
149
+ }, {
150
+ readonly name: "changelog";
151
+ readonly type: "string";
152
+ }, {
153
+ readonly name: "pushedBy";
154
+ readonly type: "address";
155
+ }, {
156
+ readonly name: "pushedAt";
157
+ readonly type: "uint256";
158
+ }];
159
+ }];
160
+ readonly stateMutability: "view";
161
+ }, {
162
+ readonly type: "function";
163
+ readonly name: "getVersionCount";
164
+ readonly inputs: readonly [{
165
+ readonly name: "projectId";
166
+ readonly type: "uint256";
167
+ }];
168
+ readonly outputs: readonly [{
169
+ readonly name: "";
170
+ readonly type: "uint256";
171
+ }];
172
+ readonly stateMutability: "view";
173
+ }, {
174
+ readonly type: "function";
175
+ readonly name: "getCollaborators";
176
+ readonly inputs: readonly [{
177
+ readonly name: "projectId";
178
+ readonly type: "uint256";
179
+ }];
180
+ readonly outputs: readonly [{
181
+ readonly name: "";
182
+ readonly type: "address[]";
183
+ }];
184
+ readonly stateMutability: "view";
185
+ }, {
186
+ readonly type: "function";
187
+ readonly name: "getOwnerProjects";
188
+ readonly inputs: readonly [{
189
+ readonly name: "owner_";
190
+ readonly type: "address";
191
+ }];
192
+ readonly outputs: readonly [{
193
+ readonly name: "";
194
+ readonly type: "uint256[]";
195
+ }];
196
+ readonly stateMutability: "view";
197
+ }, {
198
+ readonly type: "function";
199
+ readonly name: "getAgentProjects";
200
+ readonly inputs: readonly [{
201
+ readonly name: "offset";
202
+ readonly type: "uint256";
203
+ }, {
204
+ readonly name: "limit";
205
+ readonly type: "uint256";
206
+ }];
207
+ readonly outputs: readonly [{
208
+ readonly name: "";
209
+ readonly type: "tuple[]";
210
+ readonly components: readonly [{
211
+ readonly name: "id";
212
+ readonly type: "uint256";
213
+ }, {
214
+ readonly name: "name";
215
+ readonly type: "string";
216
+ }, {
217
+ readonly name: "description";
218
+ readonly type: "string";
219
+ }, {
220
+ readonly name: "license";
221
+ readonly type: "string";
222
+ }, {
223
+ readonly name: "readmeHash";
224
+ readonly type: "string";
225
+ }, {
226
+ readonly name: "owner";
227
+ readonly type: "address";
228
+ }, {
229
+ readonly name: "isPublic";
230
+ readonly type: "bool";
231
+ }, {
232
+ readonly name: "isAgent";
233
+ readonly type: "bool";
234
+ }, {
235
+ readonly name: "agentEndpoint";
236
+ readonly type: "string";
237
+ }, {
238
+ readonly name: "createdAt";
239
+ readonly type: "uint256";
240
+ }, {
241
+ readonly name: "versionCount";
242
+ readonly type: "uint256";
243
+ }, {
244
+ readonly name: "exists";
245
+ readonly type: "bool";
246
+ }];
247
+ }];
248
+ readonly stateMutability: "view";
249
+ }, {
250
+ readonly type: "function";
251
+ readonly name: "isCollaborator";
252
+ readonly inputs: readonly [{
253
+ readonly name: "projectId";
254
+ readonly type: "uint256";
255
+ }, {
256
+ readonly name: "collaborator";
257
+ readonly type: "address";
258
+ }];
259
+ readonly outputs: readonly [{
260
+ readonly name: "";
261
+ readonly type: "bool";
262
+ }];
263
+ readonly stateMutability: "view";
264
+ }, {
265
+ readonly type: "function";
266
+ readonly name: "nameTaken";
267
+ readonly inputs: readonly [{
268
+ readonly name: "name";
269
+ readonly type: "string";
270
+ }];
271
+ readonly outputs: readonly [{
272
+ readonly name: "";
273
+ readonly type: "bool";
274
+ }];
275
+ readonly stateMutability: "view";
276
+ }, {
277
+ readonly type: "function";
278
+ readonly name: "createProject";
279
+ readonly inputs: readonly [{
280
+ readonly name: "name";
281
+ readonly type: "string";
282
+ }, {
283
+ readonly name: "description";
284
+ readonly type: "string";
285
+ }, {
286
+ readonly name: "license";
287
+ readonly type: "string";
288
+ }, {
289
+ readonly name: "isPublic";
290
+ readonly type: "bool";
291
+ }, {
292
+ readonly name: "readmeHash";
293
+ readonly type: "string";
294
+ }, {
295
+ readonly name: "isAgent";
296
+ readonly type: "bool";
297
+ }, {
298
+ readonly name: "agentEndpoint";
299
+ readonly type: "string";
300
+ }];
301
+ readonly outputs: readonly [];
302
+ readonly stateMutability: "nonpayable";
303
+ }, {
304
+ readonly type: "function";
305
+ readonly name: "pushVersion";
306
+ readonly inputs: readonly [{
307
+ readonly name: "projectId";
308
+ readonly type: "uint256";
309
+ }, {
310
+ readonly name: "arweaveHash";
311
+ readonly type: "string";
312
+ }, {
313
+ readonly name: "versionTag";
314
+ readonly type: "string";
315
+ }, {
316
+ readonly name: "changelog";
317
+ readonly type: "string";
318
+ }];
319
+ readonly outputs: readonly [];
320
+ readonly stateMutability: "payable";
321
+ }, {
322
+ readonly type: "function";
323
+ readonly name: "addCollaborator";
324
+ readonly inputs: readonly [{
325
+ readonly name: "projectId";
326
+ readonly type: "uint256";
327
+ }, {
328
+ readonly name: "collaborator";
329
+ readonly type: "address";
330
+ }];
331
+ readonly outputs: readonly [];
332
+ readonly stateMutability: "nonpayable";
333
+ }, {
334
+ readonly type: "function";
335
+ readonly name: "removeCollaborator";
336
+ readonly inputs: readonly [{
337
+ readonly name: "projectId";
338
+ readonly type: "uint256";
339
+ }, {
340
+ readonly name: "collaborator";
341
+ readonly type: "address";
342
+ }];
343
+ readonly outputs: readonly [];
344
+ readonly stateMutability: "nonpayable";
345
+ }, {
346
+ readonly type: "function";
347
+ readonly name: "transferProject";
348
+ readonly inputs: readonly [{
349
+ readonly name: "projectId";
350
+ readonly type: "uint256";
351
+ }, {
352
+ readonly name: "newOwner";
353
+ readonly type: "address";
354
+ }];
355
+ readonly outputs: readonly [];
356
+ readonly stateMutability: "payable";
357
+ }, {
358
+ readonly type: "function";
359
+ readonly name: "setVisibility";
360
+ readonly inputs: readonly [{
361
+ readonly name: "projectId";
362
+ readonly type: "uint256";
363
+ }, {
364
+ readonly name: "isPublic";
365
+ readonly type: "bool";
366
+ }];
367
+ readonly outputs: readonly [];
368
+ readonly stateMutability: "nonpayable";
369
+ }, {
370
+ readonly type: "function";
371
+ readonly name: "setReadme";
372
+ readonly inputs: readonly [{
373
+ readonly name: "projectId";
374
+ readonly type: "uint256";
375
+ }, {
376
+ readonly name: "arweaveHash";
377
+ readonly type: "string";
378
+ }];
379
+ readonly outputs: readonly [];
380
+ readonly stateMutability: "nonpayable";
381
+ }, {
382
+ readonly type: "function";
383
+ readonly name: "setAgentEndpoint";
384
+ readonly inputs: readonly [{
385
+ readonly name: "projectId";
386
+ readonly type: "uint256";
387
+ }, {
388
+ readonly name: "endpoint";
389
+ readonly type: "string";
390
+ }];
391
+ readonly outputs: readonly [];
392
+ readonly stateMutability: "nonpayable";
393
+ }, {
394
+ readonly type: "event";
395
+ readonly name: "ProjectCreated";
396
+ readonly inputs: readonly [{
397
+ readonly name: "projectId";
398
+ readonly type: "uint256";
399
+ readonly indexed: true;
400
+ }, {
401
+ readonly name: "owner";
402
+ readonly type: "address";
403
+ readonly indexed: true;
404
+ }, {
405
+ readonly name: "name";
406
+ readonly type: "string";
407
+ readonly indexed: false;
408
+ }, {
409
+ readonly name: "license";
410
+ readonly type: "string";
411
+ readonly indexed: false;
412
+ }];
413
+ }, {
414
+ readonly type: "event";
415
+ readonly name: "VersionPushed";
416
+ readonly inputs: readonly [{
417
+ readonly name: "projectId";
418
+ readonly type: "uint256";
419
+ readonly indexed: true;
420
+ }, {
421
+ readonly name: "arweaveHash";
422
+ readonly type: "string";
423
+ readonly indexed: false;
424
+ }, {
425
+ readonly name: "versionTag";
426
+ readonly type: "string";
427
+ readonly indexed: false;
428
+ }, {
429
+ readonly name: "pushedBy";
430
+ readonly type: "address";
431
+ readonly indexed: false;
432
+ }];
433
+ }];
434
+ /** Minimal ABI fragment for InkdToken.sol (ERC-20 approve) */
435
+ export declare const INKD_ERC20_ABI: readonly [{
436
+ readonly type: "function";
437
+ readonly name: "approve";
438
+ readonly inputs: readonly [{
439
+ readonly name: "spender";
440
+ readonly type: "address";
441
+ }, {
442
+ readonly name: "amount";
443
+ readonly type: "uint256";
444
+ }];
445
+ readonly outputs: readonly [{
446
+ readonly name: "";
447
+ readonly type: "bool";
448
+ }];
449
+ readonly stateMutability: "nonpayable";
450
+ }, {
451
+ readonly type: "function";
452
+ readonly name: "allowance";
453
+ readonly inputs: readonly [{
454
+ readonly name: "owner";
455
+ readonly type: "address";
456
+ }, {
457
+ readonly name: "spender";
458
+ readonly type: "address";
459
+ }];
460
+ readonly outputs: readonly [{
461
+ readonly name: "";
462
+ readonly type: "uint256";
463
+ }];
464
+ readonly stateMutability: "view";
465
+ }, {
466
+ readonly type: "function";
467
+ readonly name: "balanceOf";
468
+ readonly inputs: readonly [{
469
+ readonly name: "account";
470
+ readonly type: "address";
471
+ }];
472
+ readonly outputs: readonly [{
473
+ readonly name: "";
474
+ readonly type: "uint256";
475
+ }];
476
+ readonly stateMutability: "view";
477
+ }];
478
+ export type Address = `0x${string}`;
479
+ /** Mirrors InkdRegistry.Project struct */
480
+ export interface Project {
481
+ id: bigint;
482
+ name: string;
483
+ description: string;
484
+ license: string;
485
+ readmeHash: string;
486
+ owner: Address;
487
+ isPublic: boolean;
488
+ isAgent: boolean;
489
+ agentEndpoint: string;
490
+ createdAt: bigint;
491
+ versionCount: bigint;
492
+ exists: boolean;
493
+ }
494
+ /** Mirrors InkdRegistry.Version struct */
495
+ export interface ProjectVersion {
496
+ projectId: bigint;
497
+ arweaveHash: string;
498
+ versionTag: string;
499
+ changelog: string;
500
+ pushedBy: Address;
501
+ pushedAt: bigint;
502
+ }
503
+ /** Options for creating a project */
504
+ export interface CreateProjectOptions {
505
+ /** Unique project name. Normalized to lowercase on-chain. */
506
+ name: string;
507
+ /** Human-readable description. */
508
+ description?: string;
509
+ /** SPDX license identifier, e.g. "MIT", "GPL-3.0", "Proprietary". */
510
+ license?: string;
511
+ /** Whether the project is publicly listed. Default: true. */
512
+ isPublic?: boolean;
513
+ /** Arweave hash of the README file. */
514
+ readmeHash?: string;
515
+ /** Whether this project represents an AI agent. */
516
+ isAgent?: boolean;
517
+ /** Agent API endpoint (only relevant when isAgent=true). */
518
+ agentEndpoint?: string;
519
+ }
520
+ /** Options for pushing a version */
521
+ export interface PushVersionOptions {
522
+ /** Project ID to push to. */
523
+ projectId: bigint;
524
+ /** Arweave transaction hash of the uploaded file. */
525
+ arweaveHash: string;
526
+ /** Version identifier, e.g. "v1.0.0" or "checkpoint-42". */
527
+ versionTag: string;
528
+ /** Human-readable changelog entry. */
529
+ changelog?: string;
530
+ }
531
+ /** Result from createProject() */
532
+ export interface CreateProjectResult {
533
+ /** Transaction hash. */
534
+ hash: Address;
535
+ /** The new project's on-chain ID. */
536
+ projectId: bigint;
537
+ }
538
+ /** Result from pushVersion() */
539
+ export interface PushVersionResult {
540
+ /** Transaction hash. */
541
+ hash: Address;
542
+ /** The version index within the project (0-based). */
543
+ versionIndex: bigint;
544
+ }
545
+ /** Registry client configuration */
546
+ export interface ProjectRegistryConfig {
547
+ /** InkdRegistry proxy address. */
548
+ registryAddress: Address;
549
+ /** $INKD ERC-20 token address. */
550
+ tokenAddress: Address;
551
+ /** Chain ID (8453 = Base, 84532 = Base Sepolia). */
552
+ chainId: 8453 | 84532;
553
+ }
554
+ export declare class RegistryNotConnected extends Error {
555
+ constructor();
556
+ }
557
+ export declare class InsufficientInkdBalance extends Error {
558
+ constructor(balance: bigint, required: bigint);
559
+ }
560
+ export declare class InsufficientEthBalance extends Error {
561
+ constructor(fee: bigint);
562
+ }
563
+ /**
564
+ * TypeScript client for InkdRegistry.sol.
565
+ *
566
+ * Wraps all on-chain registry operations with typed inputs/outputs,
567
+ * automatic $INKD approval, and fee estimation.
568
+ */
569
+ export declare class ProjectRegistry {
570
+ private config;
571
+ private walletClient;
572
+ private publicClient;
573
+ constructor(config: ProjectRegistryConfig);
574
+ /**
575
+ * Attach viem wallet + public clients.
576
+ * Must be called before any on-chain write.
577
+ */
578
+ connect(walletClient: WalletClient<Transport, Chain, Account>, publicClient: PublicClient): void;
579
+ /** Get a project by ID. Returns null if the project does not exist. */
580
+ getProject(projectId: bigint): Promise<Project | null>;
581
+ /** Get a specific version from a project. */
582
+ getVersion(projectId: bigint, versionIndex: bigint): Promise<ProjectVersion>;
583
+ /** Get all versions of a project in chronological order. */
584
+ getAllVersions(projectId: bigint): Promise<ProjectVersion[]>;
585
+ /** Get all project IDs owned by an address. */
586
+ getOwnerProjects(owner: Address): Promise<bigint[]>;
587
+ /** Get all collaborators of a project. */
588
+ getCollaborators(projectId: bigint): Promise<Address[]>;
589
+ /** Check if an address is a collaborator on a project. */
590
+ isCollaborator(projectId: bigint, address: Address): Promise<boolean>;
591
+ /** Check if a project name is already taken (case-insensitive). */
592
+ isNameTaken(name: string): Promise<boolean>;
593
+ /** Get all agent projects with optional pagination. */
594
+ getAgentProjects(offset?: bigint, limit?: bigint): Promise<Project[]>;
595
+ /** Get the current version fee (ETH wei). */
596
+ getVersionFee(): Promise<bigint>;
597
+ /** Get the current transfer fee (ETH wei). */
598
+ getTransferFee(): Promise<bigint>;
599
+ /** Get the total number of projects on-chain. */
600
+ getProjectCount(): Promise<bigint>;
601
+ /**
602
+ * Create a new project on-chain.
603
+ *
604
+ * Automatically approves the 1 $INKD token lock if the current allowance
605
+ * is insufficient.
606
+ *
607
+ * @throws {InsufficientInkdBalance} if caller has less than 1 $INKD.
608
+ */
609
+ createProject(opts: CreateProjectOptions): Promise<CreateProjectResult>;
610
+ /**
611
+ * Push a new version to an existing project.
612
+ *
613
+ * Automatically reads the current versionFee and sends the exact amount.
614
+ * If you want to overpay (all excess goes to treasury), pass `value` explicitly.
615
+ *
616
+ * @throws {InsufficientEthBalance} if caller's ETH balance < versionFee.
617
+ */
618
+ pushVersion(opts: PushVersionOptions, value?: bigint): Promise<PushVersionResult>;
619
+ /** Add a collaborator to a project. Caller must be the project owner. */
620
+ addCollaborator(projectId: bigint, collaborator: Address): Promise<Address>;
621
+ /** Remove a collaborator from a project. Caller must be the project owner. */
622
+ removeCollaborator(projectId: bigint, collaborator: Address): Promise<Address>;
623
+ /**
624
+ * Transfer project ownership to a new address.
625
+ * Automatically reads the current transferFee and sends the exact amount.
626
+ *
627
+ * Note: the 1 $INKD lock stays with the project — it is NOT refunded or
628
+ * transferred back to the old owner.
629
+ */
630
+ transferProject(projectId: bigint, newOwner: Address, value?: bigint): Promise<Address>;
631
+ /** Set project public/private visibility. Caller must be the project owner. */
632
+ setVisibility(projectId: bigint, isPublic: boolean): Promise<Address>;
633
+ /** Update the README Arweave hash. Caller must be the project owner. */
634
+ setReadme(projectId: bigint, arweaveHash: string): Promise<Address>;
635
+ /** Update the agent endpoint URL. Caller must be the project owner. */
636
+ setAgentEndpoint(projectId: bigint, endpoint: string): Promise<Address>;
637
+ /**
638
+ * Estimate the total ETH cost of one version push.
639
+ * (versionFee — gas excluded)
640
+ */
641
+ estimatePushCost(): Promise<bigint>;
642
+ /**
643
+ * Estimate the total ETH cost of a project transfer.
644
+ * (transferFee — gas excluded)
645
+ */
646
+ estimateTransferCost(): Promise<bigint>;
647
+ private requireWallet;
648
+ private requirePublic;
649
+ /**
650
+ * Extract the new project ID from the ProjectCreated event.
651
+ * Falls back to 0n if not found (should not happen under normal conditions).
652
+ */
653
+ private extractProjectIdFromLogs;
654
+ }
655
+ //# sourceMappingURL=ProjectRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProjectRegistry.d.ts","sourceRoot":"","sources":["../src/ProjectRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,EACL,SAAS,EAEV,MAAM,MAAM,CAAC;AAId,gDAAgD;AAChD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+PpB,CAAC;AAEX,8DAA8D;AAC9D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA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