8004-solana 0.2.0 → 0.2.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.
Files changed (44) hide show
  1. package/README.md +151 -214
  2. package/dist/core/borsh-schemas.d.ts +27 -0
  3. package/dist/core/borsh-schemas.d.ts.map +1 -1
  4. package/dist/core/borsh-schemas.js +49 -0
  5. package/dist/core/borsh-schemas.js.map +1 -1
  6. package/dist/core/feedback-manager-solana.d.ts +25 -7
  7. package/dist/core/feedback-manager-solana.d.ts.map +1 -1
  8. package/dist/core/feedback-manager-solana.js +151 -67
  9. package/dist/core/feedback-manager-solana.js.map +1 -1
  10. package/dist/core/instruction-builder.d.ts +3 -17
  11. package/dist/core/instruction-builder.d.ts.map +1 -1
  12. package/dist/core/instruction-builder.js +6 -73
  13. package/dist/core/instruction-builder.js.map +1 -1
  14. package/dist/core/instruction-discriminators.d.ts +34 -54
  15. package/dist/core/instruction-discriminators.d.ts.map +1 -1
  16. package/dist/core/instruction-discriminators.js +34 -65
  17. package/dist/core/instruction-discriminators.js.map +1 -1
  18. package/dist/core/oasf-validator.d.ts +10 -0
  19. package/dist/core/oasf-validator.d.ts.map +1 -1
  20. package/dist/core/oasf-validator.js +21 -6
  21. package/dist/core/oasf-validator.js.map +1 -1
  22. package/dist/core/pda-helpers.d.ts +13 -7
  23. package/dist/core/pda-helpers.d.ts.map +1 -1
  24. package/dist/core/pda-helpers.js +22 -12
  25. package/dist/core/pda-helpers.js.map +1 -1
  26. package/dist/core/sdk-solana.d.ts +59 -15
  27. package/dist/core/sdk-solana.d.ts.map +1 -1
  28. package/dist/core/sdk-solana.js +232 -112
  29. package/dist/core/sdk-solana.js.map +1 -1
  30. package/dist/core/transaction-builder.d.ts +4 -7
  31. package/dist/core/transaction-builder.d.ts.map +1 -1
  32. package/dist/core/transaction-builder.js +40 -64
  33. package/dist/core/transaction-builder.js.map +1 -1
  34. package/dist/index.d.ts +4 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +4 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/models/interfaces.d.ts +10 -7
  39. package/dist/models/interfaces.d.ts.map +1 -1
  40. package/dist/utils/registration-file-builder.d.ts +1 -0
  41. package/dist/utils/registration-file-builder.d.ts.map +1 -1
  42. package/dist/utils/registration-file-builder.js +21 -3
  43. package/dist/utils/registration-file-builder.js.map +1 -1
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -1,20 +1,18 @@
1
1
  # 8004-solana
2
2
 
3
- > TypeScript SDK for ERC-8004 on Solana
3
+ > TypeScript SDK for 8004 on Solana
4
4
  > Agent identity, reputation and validation standard
5
5
 
6
6
  [![npm](https://img.shields.io/npm/v/8004-solana)](https://www.npmjs.com/package/8004-solana)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
- [![GitHub](https://img.shields.io/badge/GitHub-QuantuLabs%2F8004--solana--ts-blue)](https://github.com/QuantuLabs/8004-solana-ts)
8
+ [![GitHub](https://img.shields.io/badge/GitHub-QuantuLabs%2F8004--solana-blue)](https://github.com/QuantuLabs/8004-solana)
9
9
  [![Solana Programs](https://img.shields.io/badge/Programs-8004--solana-purple)](https://github.com/QuantuLabs/8004-solana)
10
10
 
11
- > **v0.2.0** - Consolidated program architecture with Metaplex Core
12
-
13
11
  ---
14
12
 
15
13
  ## About
16
14
 
17
- **8004-solana-ts** is a TypeScript SDK implementing the [ERC-8004 standard](https://eips.ethereum.org/EIPS/eip-8004) on Solana. It provides a seamless way to:
15
+ **8004-solana** is a TypeScript SDK implementing the [8004 standard](https://eips.ethereum.org/EIPS/eip-8004) on Solana. It provides a seamless way to:
18
16
 
19
17
  - **Register agents as NFTs** on Solana blockchain
20
18
  - **Manage agent metadata** and endpoints (MCP, A2A)
@@ -22,8 +20,6 @@
22
20
  - **Track agent ownership** and transfers
23
21
  - **OASF taxonomies** support (skills & domains)
24
22
 
25
- Built with compatibility in mind - API aligned with the reference [agent0-ts SDK](https://github.com/agent0lab/agent0-ts).
26
-
27
23
  ---
28
24
 
29
25
  ## Installation
@@ -36,177 +32,185 @@ yarn add 8004-solana
36
32
  pnpm add 8004-solana
37
33
  ```
38
34
 
39
- ### Or install from GitHub
40
-
41
- ```bash
42
- npm install github:QuantuLabs/8004-solana-ts
43
- ```
44
-
45
35
  ---
46
36
 
47
37
  ## Quick Start
48
38
 
39
+ ### 1. Setup SDK
40
+
49
41
  ```typescript
50
42
  import { SolanaSDK } from '8004-solana';
51
43
  import { Keypair } from '@solana/web3.js';
52
44
 
53
- // 1. Setup SDK with signer
54
- const signer = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(process.env.SOLANA_PRIVATE_KEY!)));
45
+ // Load your wallet keypair from environment variable
46
+ // The private key should be a JSON array of bytes: [1,2,3,...]
47
+ const privateKey = JSON.parse(process.env.SOLANA_PRIVATE_KEY!);
48
+ const signer = Keypair.fromSecretKey(Uint8Array.from(privateKey));
49
+
50
+ // Initialize the SDK with your signer
51
+ // Default cluster is 'devnet', use { cluster: 'mainnet-beta' } for production
55
52
  const sdk = new SolanaSDK({ signer });
53
+ ```
56
54
 
57
- // 2. Register a new agent
58
- const registration = await sdk.registerAgent('ipfs://QmAgentMetadata');
59
- const agentId = registration.agentId!;
60
- console.log(`✓ Agent #${agentId} registered`);
55
+ ### 2. Register an Agent
61
56
 
62
- // 3. Set on-chain metadata (optional)
63
- await sdk.setMetadata(agentId, 'version', '1.0.0');
64
- await sdk.setMetadata(agentId, 'certification', 'verified', true); // immutable
65
- console.log('✓ On-chain metadata set');
57
+ **Step 1: Setup IPFS Client**
66
58
 
67
- // 4. Load agent data
68
- const agent = await sdk.loadAgent(agentId);
69
- console.log(`Agent: ${agent?.nft_name}, Owner: ${agent?.getOwnerPublicKey().toBase58()}`);
59
+ The SDK includes a built-in IPFS client with Pinata support:
70
60
 
71
- // 5. Give feedback (from another user)
72
- await sdk.giveFeedback(agentId, {
73
- score: 85,
74
- tag1: 'helpful',
75
- tag2: 'accurate',
76
- fileUri: 'ipfs://QmFeedbackDetails',
77
- fileHash: Buffer.alloc(32),
61
+ ```typescript
62
+ import {
63
+ SolanaSDK,
64
+ IPFSClient,
65
+ buildRegistrationFileJson,
66
+ EndpointType
67
+ } from '8004-solana';
68
+
69
+ // Get a free Pinata JWT at https://pinata.cloud
70
+ const ipfs = new IPFSClient({
71
+ pinataEnabled: true,
72
+ pinataJwt: process.env.PINATA_JWT,
78
73
  });
79
- console.log('✓ Feedback submitted');
80
-
81
- // 6. Get reputation summary
82
- const summary = await sdk.getReputationSummary(agentId);
83
- console.log(`Score: ${summary.averageScore}/100 (${summary.count} reviews)`);
84
74
 
85
- // 7. Transfer agent (optional)
86
- // await sdk.transferAgent(agentId, newOwnerPublicKey);
75
+ // Or use a local IPFS node
76
+ // const ipfs = new IPFSClient({ url: 'http://localhost:5001' });
87
77
  ```
88
78
 
89
- > **Note**: For advanced queries like `getAgentsByOwner()`, a custom RPC provider is recommended.
90
- > Free tiers are available - see [RPC Provider Recommendations](#rpc-provider-recommendations).
79
+ **Step 2: Upload Agent Image**
91
80
 
92
- 📁 **More examples**: See the [`examples/`](#examples) directory for complete usage patterns.
81
+ ```typescript
82
+ // Upload image file to IPFS
83
+ const imageCid = await ipfs.addFile('./agent-avatar.png');
84
+ const imageUri = `ipfs://${imageCid}`;
85
+ ```
93
86
 
94
- ---
87
+ **Step 3: Build and Upload Metadata**
95
88
 
96
- ## SolanaSDK API Reference
89
+ ```typescript
90
+ const agentData = {
91
+ name: 'My AI Assistant',
92
+ description: 'A helpful AI agent for task automation',
93
+ image: imageUri, // IPFS image from step 2
94
+ endpoints: [
95
+ { type: EndpointType.MCP, value: 'https://api.example.com/mcp' },
96
+ { type: EndpointType.A2A, value: 'https://api.example.com/a2a' },
97
+ ],
98
+ // OASF taxonomies (optional) - see docs/OASF.md for valid slugs
99
+ skills: ['natural_language_processing/natural_language_generation/summarization'],
100
+ domains: ['technology/software_engineering/software_engineering'],
101
+ };
102
+
103
+ // Build 8004-compliant JSON and upload to IPFS
104
+ const metadata = buildRegistrationFileJson(agentData);
105
+ const metadataCid = await ipfs.addJson(metadata);
106
+ const metadataUri = `ipfs://${metadataCid}`;
107
+ ```
97
108
 
98
- ### Constructor
109
+ **Step 4: Register on Solana**
99
110
 
100
111
  ```typescript
101
- import { SolanaSDK } from '8004-solana';
102
- import { Keypair } from '@solana/web3.js';
103
-
104
- // Default: devnet, read-only
105
- const sdk = new SolanaSDK();
112
+ const sdk = new SolanaSDK({ signer });
113
+ const result = await sdk.registerAgent(metadataUri);
114
+ console.log(`Agent #${result.agentId} registered!`);
115
+ ```
106
116
 
107
- // With signer (for write operations)
108
- const sdk = new SolanaSDK({ signer: Keypair.generate() });
117
+ **Alternative: Use Web URLs**
109
118
 
110
- // Custom RPC (for advanced queries)
111
- const sdk = new SolanaSDK({ rpcUrl: 'https://your-rpc.helius.dev' });
119
+ You can host metadata anywhere accessible via HTTP:
112
120
 
113
- // Full config
114
- const sdk = new SolanaSDK({
115
- cluster: 'devnet', // 'devnet' | 'mainnet-beta' (default: 'devnet')
116
- rpcUrl: 'https://...', // Optional custom RPC
117
- signer: keypair, // Optional signer for write operations
121
+ ```typescript
122
+ // Build JSON without IPFS
123
+ const metadata = buildRegistrationFileJson({
124
+ name: 'My AI Assistant',
125
+ image: 'https://my-server.com/agent-avatar.png',
126
+ // ...
118
127
  });
119
- ```
120
128
 
121
- ### Utility Methods
129
+ // Host this JSON on your server, S3, Vercel, etc.
130
+ await sdk.registerAgent('https://my-server.com/agent-metadata.json');
131
+ ```
122
132
 
123
- | Method | Return Type | Description |
124
- |--------|-------------|-------------|
125
- | `isReadOnly` | `boolean` | True if SDK has no signer |
126
- | `canWrite` | `boolean` | True if SDK can perform write operations |
127
- | `chainId()` | `Promise<string>` | Returns `solana-{cluster}` (e.g., `solana-devnet`) |
128
- | `getCluster()` | `Cluster` | Returns current cluster name |
129
- | `registries()` | `Record<string, string>` | Returns program IDs (`IDENTITY`, `REPUTATION`, `VALIDATION`) |
130
- | `getProgramIds()` | `object` | Returns program IDs as PublicKey objects |
131
- | `getRpcUrl()` | `string` | Returns current RPC URL |
132
- | `supportsAdvancedQueries()` | `boolean` | True if RPC supports getProgramAccounts with memcmp |
133
+ ### 3. Load Agent Data
133
134
 
134
- ### Agent Read Methods
135
+ ```typescript
136
+ // Fetch agent by ID
137
+ const agent = await sdk.loadAgent(agentId);
135
138
 
136
- | Method | Signature | Description |
137
- |--------|-----------|-------------|
138
- | `loadAgent` | `(agentId: number \| bigint) => Promise<AgentAccount \| null>` | Load agent data from chain |
139
- | `getAgent` | `(agentId: number \| bigint) => Promise<AgentAccount \| null>` | Alias for loadAgent |
140
- | `agentExists` | `(agentId: number \| bigint) => Promise<boolean>` | Check if agent exists |
141
- | `getAgentOwner` | `(agentId: number \| bigint) => Promise<PublicKey \| null>` | Get agent owner |
142
- | `isAgentOwner` | `(agentId, address) => Promise<boolean>` | Check if address owns agent |
139
+ if (agent) {
140
+ console.log(`Name: ${agent.nft_name}`);
141
+ console.log(`Owner: ${agent.getOwnerPublicKey().toBase58()}`);
142
+ console.log(`URI: ${agent.agent_uri}`);
143
+ console.log(`Asset: ${agent.getAssetPublicKey().toBase58()}`);
144
+ }
143
145
 
144
- ### Agent Write Methods
146
+ // Or fetch all agents owned by a wallet (requires custom RPC)
147
+ import { PublicKey } from '@solana/web3.js';
145
148
 
146
- | Method | Signature | Description |
147
- |--------|-----------|-------------|
148
- | `registerAgent` | `(tokenUri?, metadata?) => Promise<TransactionResult>` | Register new agent |
149
- | `transferAgent` | `(agentId, newOwner) => Promise<TransactionResult>` | Transfer agent ownership |
150
- | `setAgentUri` | `(agentId, newUri) => Promise<TransactionResult>` | Update agent URI |
151
- | `setMetadata` | `(agentId, key, value, immutable?) => Promise<TransactionResult>` | Set on-chain metadata (optional, PDA-based) |
149
+ const ownerWallet = new PublicKey('YourWalletAddress...');
150
+ const myAgents = await sdk.getAgentsByOwner(ownerWallet);
152
151
 
153
- **On-chain Metadata (v0.2.0, optional):**
152
+ for (const agent of myAgents) {
153
+ console.log(`Agent #${agent.agent_id}: ${agent.nft_name}`);
154
+ }
155
+ ```
154
156
 
155
- Store arbitrary key-value pairs directly on-chain. This is optional - most agent data should be in the IPFS registration file.
157
+ ### 4. Give Feedback
156
158
 
157
159
  ```typescript
158
- // Set mutable on-chain metadata (default)
159
- await sdk.setMetadata(agentId, 'version', '1.0.0');
160
-
161
- // Set immutable on-chain metadata (cannot be modified or deleted)
162
- await sdk.setMetadata(agentId, 'certification', 'verified', true);
160
+ // Submit feedback for an agent (as a client/user)
161
+ // Score is 0-100, tags are optional keywords
162
+ await sdk.giveFeedback(agentId, {
163
+ score: 85, // Rating out of 100
164
+ tag1: 'helpful', // Optional: first tag
165
+ tag2: 'accurate', // Optional: second tag
166
+ fileUri: 'ipfs://QmFeedbackDetails', // Optional: detailed feedback file
167
+ fileHash: Buffer.alloc(32), // Optional: SHA256 hash of file
168
+ });
163
169
  ```
164
170
 
165
- ### Reputation Methods
166
-
167
- | Method | Signature | Description |
168
- |--------|-----------|-------------|
169
- | `getSummary` | `(agentId, minScore?, clientFilter?) => Promise<ReputationSummary>` | Get full reputation summary |
170
- | `getReputationSummary` | `(agentId) => Promise<{count, averageScore}>` | Get simplified reputation stats |
171
- | `giveFeedback` | `(agentId, feedbackFile) => Promise<TransactionResult>` | Submit feedback |
172
- | `getFeedback` | `(agentId, client, index) => Promise<Feedback \| null>` | Read specific feedback |
173
- | `readFeedback` | `(agentId, client, index) => Promise<Feedback \| null>` | Alias for getFeedback |
174
- | `revokeFeedback` | `(agentId, index) => Promise<TransactionResult>` | Revoke submitted feedback |
175
- | `getLastIndex` | `(agentId, client) => Promise<bigint>` | Get last feedback index |
176
- | `appendResponse` | `(agentId, client, index, uri, hash) => Promise<TransactionResult>` | Add response to feedback |
171
+ ### 5. Get Reputation
177
172
 
178
- ### Validation Methods
179
-
180
- | Method | Signature | Description |
181
- |--------|-----------|-------------|
182
- | `requestValidation` | `(agentId, validator, methodId, uri, hash) => Promise<TransactionResult>` | Request validation |
183
- | `respondToValidation` | `(agentId, requestIndex, score, uri, hash, status) => Promise<TransactionResult>` | Respond to validation |
173
+ ```typescript
174
+ // Get aggregated reputation stats
175
+ const summary = await sdk.getSummary(agentId);
176
+ console.log(`Average Score: ${summary.averageScore}/100`);
177
+ console.log(`Total Feedbacks: ${summary.totalFeedbacks}`);
178
+ console.log(`Next Index: ${summary.nextFeedbackIndex}`);
179
+
180
+ // Read all individual feedbacks (requires custom RPC)
181
+ const feedbacks = await sdk.readAllFeedback(agentId);
182
+ for (const fb of feedbacks) {
183
+ console.log(`Score: ${fb.score}, Client: ${fb.client.toBase58()}`);
184
+ }
185
+ ```
184
186
 
185
- ### Advanced Queries (Requires Custom RPC)
187
+ ### 6. Bulk Queries (Indexing)
186
188
 
187
- These methods require a custom RPC provider (Helius, Triton, etc.) that supports `getProgramAccounts`:
189
+ ```typescript
190
+ // Get ALL agents with their feedbacks in just 4 RPC calls
191
+ const agents = await sdk.getAllAgents({ includeFeedbacks: true });
192
+ for (const { account, feedbacks } of agents) {
193
+ console.log(`Agent #${account.agent_id}: ${feedbacks?.length || 0} feedbacks`);
194
+ }
195
+
196
+ // Or get ALL feedbacks separately as a Map
197
+ const feedbacksMap = await sdk.getAllFeedbacks();
198
+ const agent83Feedbacks = feedbacksMap.get(83n) || [];
199
+ ```
188
200
 
189
- | Method | Signature | Description |
190
- |--------|-----------|-------------|
191
- | `getAgentsByOwner` | `(owner: PublicKey) => Promise<AgentAccount[]>` | Get all agents owned by address |
192
- | `readAllFeedback` | `(agentId, includeRevoked?) => Promise<Feedback[]>` | Get all feedback for agent |
193
- | `getClients` | `(agentId) => Promise<PublicKey[]>` | Get all clients who gave feedback |
201
+ > **Note**: For advanced queries like `getAllAgents()`, `getAllFeedbacks()`, or `readAllFeedback()`, a custom RPC provider is required.
202
+ > Free tiers are available - see [RPC Provider Recommendations](#rpc-provider-recommendations).
194
203
 
195
204
  ---
196
205
 
197
- ## Architecture
206
+ ## Documentation
198
207
 
199
- Built on a consolidated Solana program implementing ERC-8004:
208
+ - **[API Methods](docs/METHODS.md)** - Full SDK API reference
209
+ - **[Operation Costs](docs/COSTS.md)** - Transaction costs on Solana
210
+ - **[OASF Taxonomies](docs/OASF.md)** - Skills and domains reference
211
+ - **[Changelog](docs/CHANGELOG.md)** - Version history and breaking changes
200
212
 
201
- | Program | Program ID | Description |
202
- |---------|------------|-------------|
203
- | **AgentRegistry8004** | `HvF3JqhahcX7JfhbDRYYCJ7S3f6nJdrqu5yi9shyTREp` | Identity, Reputation & Validation (consolidated) |
204
-
205
- **v0.2.0 Changes:**
206
- - Single consolidated program (was 3 separate programs)
207
- - Uses **Metaplex Core** for NFTs (was Token Metadata)
208
- - Global feedback index (was per-client)
209
- - 89 tests passing on devnet
213
+ **Program ID:** `HvF3JqhahcX7JfhbDRYYCJ7S3f6nJdrqu5yi9shyTREp`
210
214
 
211
215
  ---
212
216
 
@@ -231,6 +235,8 @@ For **production use** or **advanced queries** (like `getProgramAccounts`), use
231
235
  | `loadAgent()` | Works | Works |
232
236
  | `giveFeedback()` | Works | Works |
233
237
  | `getSummary()` | Works | Works |
238
+ | `getAllAgents()` | **Fails** | Works |
239
+ | `getAllFeedbacks()` | **Fails** | Works |
234
240
  | `getAgentsByOwner()` | **Fails** | Works |
235
241
  | `readAllFeedback()` | **Fails** | Works |
236
242
  | `getClients()` | **Fails** | Works |
@@ -253,8 +259,8 @@ const agents = await sdk.getAgentsByOwner(ownerPublicKey);
253
259
 
254
260
  ```bash
255
261
  # Clone repository
256
- git clone https://github.com/QuantuLabs/8004-solana-ts.git
257
- cd 8004-solana-ts
262
+ git clone https://github.com/QuantuLabs/8004-solana.git
263
+ cd 8004-solana
258
264
 
259
265
  # Install dependencies
260
266
  npm install
@@ -274,81 +280,6 @@ npm run format
274
280
 
275
281
  ---
276
282
 
277
- ## Current Status
278
-
279
- ### v0.2.0 - Consolidated Program Architecture
280
-
281
- **What's New:**
282
- - Single consolidated program (Identity + Reputation + Validation)
283
- - **Metaplex Core** NFTs (lighter, faster than Token Metadata)
284
- - Global feedback index for simpler PDA derivation
285
- - 89 comprehensive tests on devnet
286
-
287
- **Breaking Changes from v0.1.0:**
288
- - Program IDs changed (now single program)
289
- - Agent PDA uses Core asset address, not mint
290
- - Feedback PDA uses global index (no client address in seeds)
291
- - Response PDA removed client from seeds
292
-
293
- **Implemented:**
294
- - Agent registration with Metaplex Core
295
- - Metadata management + extensions
296
- - Permissionless feedback system
297
- - Reputation tracking with cached aggregates
298
- - Validation requests and responses
299
- - NFT-based agent identity
300
- - Interface parity with agent0-ts
301
-
302
- **Requires Custom RPC:**
303
- - `getAgentsByOwner()` - Requires getProgramAccounts
304
- - `readAllFeedback()` - Requires getProgramAccounts
305
- - `getClients()` - Requires getProgramAccounts
306
-
307
- ---
308
-
309
- ## Operation Costs (Devnet Measured v0.2.0)
310
-
311
- Costs measured via SDK E2E tests on Solana devnet:
312
-
313
- | Operation | Total Cost | Lamports | Notes |
314
- |-----------|------------|----------|-------|
315
- | Register Agent | **0.00651 SOL** | 6,507,280 | Core asset + AgentAccount |
316
- | Set On-chain Metadata (1st) | **0.00319 SOL** | 3,192,680 | +MetadataEntryPda |
317
- | Set On-chain Metadata (update) | 0.000005 SOL | 5,000 | TX fee only |
318
- | Give Feedback (1st) | 0.00332 SOL | 3,324,920 | Feedback + AgentReputation init |
319
- | Give Feedback (2nd+) | 0.00209 SOL | 2,086,040 | FeedbackAccount only |
320
- | Append Response (1st) | 0.00275 SOL | 2,747,240 | Response + ResponseIndex init |
321
- | Append Response (2nd+) | 0.00163 SOL | 1,626,680 | ResponseAccount only |
322
- | Revoke Feedback | 0.000005 SOL | 5,000 | TX fee only |
323
- | Request Validation | 0.00183 SOL | 1,828,520 | ValidationRequest |
324
- | Respond to Validation | 0.000005 SOL | 5,000 | TX fee only |
325
- | **Full Lifecycle** | **0.0245 SOL** | 24,521,040 | Complete test cycle |
326
-
327
- ### First vs Subsequent Cost Savings
328
-
329
- | Operation | 1st Call | 2nd+ Calls | Savings |
330
- |-----------|----------|------------|---------|
331
- | Set On-chain Metadata | 0.00319 SOL | 0.000005 SOL | **-99%** |
332
- | Give Feedback | 0.00332 SOL | 0.00209 SOL | **-37%** |
333
- | Append Response | 0.00275 SOL | 0.00163 SOL | **-41%** |
334
-
335
- First operation creates init_if_needed accounts. Subsequent calls skip initialization.
336
-
337
- ### v0.2.0 Optimizations
338
-
339
- | Optimization | Before | After | Savings |
340
- |--------------|--------|-------|---------|
341
- | FeedbackAccount | 375 bytes | 171 bytes | **-54%** |
342
- | ResponseAccount | 309 bytes | 105 bytes | **-66%** |
343
- | MetadataEntryPda | Vec (fixed) | Individual PDAs | Unlimited entries |
344
-
345
- **v0.2.0 Changes:**
346
- - **Hash-only storage**: URIs stored in events, only hashes on-chain
347
- - **Individual Metadata PDAs**: Unlimited entries, deletable for rent recovery
348
- - **Immutable on-chain metadata option**: Lock metadata permanently
349
-
350
- ---
351
-
352
283
  ## Contributing
353
284
 
354
285
  Contributions welcome! This is a **public build** project.
@@ -376,11 +307,12 @@ See the `examples/` directory for complete usage examples:
376
307
 
377
308
  | Example | Description |
378
309
  |---------|-------------|
379
- | [`quick-start.ts`](examples/quick-start.ts) | Basic read/write operations |
310
+ | [`quick-start.ts`](examples/quick-start.ts) | Basic read/write with IPFS upload |
380
311
  | [`feedback-usage.ts`](examples/feedback-usage.ts) | Submit and read feedback |
381
- | [`agent-update.ts`](examples/agent-update.ts) | Update agent metadata |
312
+ | [`agent-update.ts`](examples/agent-update.ts) | On-chain metadata & URI update |
382
313
  | [`transfer-agent.ts`](examples/transfer-agent.ts) | Transfer agent ownership |
383
314
  | [`server-mode.ts`](examples/server-mode.ts) | Server/client architecture with skipSend |
315
+ | [`basic-indexer.ts`](examples/basic-indexer.ts) | Index all agents to JSON file |
384
316
 
385
317
  Run examples:
386
318
  ```bash
@@ -399,20 +331,25 @@ MIT License - see [LICENSE](LICENSE) file for details.
399
331
 
400
332
  ---
401
333
 
334
+ ## Community & Support
335
+
336
+ - **Telegram (Builder Support)**: [t.me/sol8004](https://t.me/sol8004)
337
+ - **X (Twitter)**: [x.com/Quantu_AI](https://x.com/Quantu_AI)
338
+
339
+ ---
340
+
402
341
  ## Links
403
342
 
404
- - **ERC-8004 Standard**: [eips.ethereum.org/EIPS/eip-8004](https://eips.ethereum.org/EIPS/eip-8004)
405
- - **agent0-ts Reference SDK**: [github.com/agent0lab/agent0-ts](https://github.com/agent0lab/agent0-ts)
343
+ - **8004 Standard**: [eips.ethereum.org/EIPS/eip-8004](https://eips.ethereum.org/EIPS/eip-8004)
406
344
  - **Solana Programs**: [github.com/QuantuLabs/8004-solana](https://github.com/QuantuLabs/8004-solana)
407
345
 
408
346
  ---
409
347
 
410
348
  ## Acknowledgments
411
349
 
412
- - Built with inspiration from the [agent0](https://github.com/agent0lab/agent0-ts) ecosystem
413
- - Implements [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) standard on Solana
350
+ - Implements [8004](https://eips.ethereum.org/EIPS/eip-8004) standard on Solana
414
351
  - Powered by Solana blockchain and Metaplex Core
415
352
 
416
353
  ---
417
354
 
418
- **Built for the Solana ecosystem** | v0.2.0
355
+ **Built for the Solana ecosystem** | v0.2.2
@@ -51,6 +51,33 @@ export declare class AgentAccount {
51
51
  get token_uri(): string;
52
52
  get metadata(): MetadataEntry[];
53
53
  }
54
+ /**
55
+ * Metadata Entry PDA (v0.2.0 - Individual metadata storage)
56
+ * Seeds: ["agent_meta", agent_id (LE), key_hash[0..8]]
57
+ * Each metadata entry is stored in its own PDA for deleteability
58
+ */
59
+ export declare class MetadataEntryPda {
60
+ agent_id: bigint;
61
+ metadata_key: string;
62
+ metadata_value: Uint8Array;
63
+ immutable: boolean;
64
+ created_at: bigint;
65
+ bump: number;
66
+ constructor(fields: {
67
+ agent_id: bigint;
68
+ metadata_key: string;
69
+ metadata_value: Uint8Array;
70
+ immutable: boolean;
71
+ created_at: bigint;
72
+ bump: number;
73
+ });
74
+ static schema: Schema;
75
+ static deserialize(data: Buffer): MetadataEntryPda;
76
+ getValueString(): string;
77
+ get key(): string;
78
+ get value(): string;
79
+ get isImmutable(): boolean;
80
+ }
54
81
  /**
55
82
  * Registry Config Account (Identity Registry)
56
83
  * Seeds: ["config"]
@@ -1 +1 @@
1
- {"version":3,"file":"borsh-schemas.d.ts","sourceRoot":"","sources":["../../src/core/borsh-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAwB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,aAAa;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,UAAU,CAAC;gBAEf,MAAM,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,UAAU,CAAA;KAAE;IAKxE,cAAc,IAAI,MAAM;IAKxB,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,KAAK,IAAI,UAAU,CAEtB;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;gBAED,MAAM,EAAE;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,UAAU,CAAC;QAClB,UAAU,EAAE,UAAU,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;KACd;IAWD,MAAM,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AC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;gBAED,MAAM,EAAE;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,iBAAiB,EAAE,UAAU,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,UAAU,CAAC;QACzB,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;KACd;IAYD,MAAM,CAAC,MAAM,EAAE,MAAM,CAkBlB;IAEH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB;IAMnD,qBAAqB,IAAI,SAAS;IAIlC,WAAW,IAAI,OAAO;IAQtB,SAAS,IAAI,OAAO;CAOrB"}
@@ -80,6 +80,55 @@ AgentAccount.schema = new Map([
80
80
  },
81
81
  ],
82
82
  ]);
83
+ /**
84
+ * Metadata Entry PDA (v0.2.0 - Individual metadata storage)
85
+ * Seeds: ["agent_meta", agent_id (LE), key_hash[0..8]]
86
+ * Each metadata entry is stored in its own PDA for deleteability
87
+ */
88
+ export class MetadataEntryPda {
89
+ constructor(fields) {
90
+ this.agent_id = fields.agent_id;
91
+ this.metadata_key = fields.metadata_key;
92
+ this.metadata_value = fields.metadata_value;
93
+ this.immutable = fields.immutable;
94
+ this.created_at = fields.created_at;
95
+ this.bump = fields.bump;
96
+ }
97
+ static deserialize(data) {
98
+ // Skip 8-byte Anchor discriminator
99
+ const accountData = data.slice(8);
100
+ return deserializeUnchecked(this.schema, MetadataEntryPda, accountData);
101
+ }
102
+ getValueString() {
103
+ return Buffer.from(this.metadata_value).toString('utf8');
104
+ }
105
+ // Convenient getters
106
+ get key() {
107
+ return this.metadata_key;
108
+ }
109
+ get value() {
110
+ return this.getValueString();
111
+ }
112
+ get isImmutable() {
113
+ return this.immutable;
114
+ }
115
+ }
116
+ MetadataEntryPda.schema = new Map([
117
+ [
118
+ MetadataEntryPda,
119
+ {
120
+ kind: 'struct',
121
+ fields: [
122
+ ['agent_id', 'u64'],
123
+ ['metadata_key', 'string'],
124
+ ['metadata_value', ['u8']], // Vec<u8>
125
+ ['immutable', 'u8'], // bool as u8
126
+ ['created_at', 'u64'], // i64 as u64 (borsh 0.7 limitation)
127
+ ['bump', 'u8'],
128
+ ],
129
+ },
130
+ ],
131
+ ]);
83
132
  /**
84
133
  * Registry Config Account (Identity Registry)
85
134
  * Seeds: ["config"]