@brainai/satp-client 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,82 +1,466 @@
1
- # SATP JavaScript SDK
1
+ # SATP V3 SDK — `@brainai/satp-client`
2
2
 
3
- Lightweight SDK for interacting with SATP (Solana Agent Token Protocol) programs on Solana.
3
+ **Solana Agent Token Protocol** — JavaScript/TypeScript SDK for interacting with the SATP V3 devnet programs.
4
4
 
5
- ## Install
5
+ Version: **3.3.0** | Tests: **101 unit + 16 devnet integration** | Programs: **6**
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
- cd satp-sdk && npm install
10
+ npm install git+https://github.com/brainAI-bot/satp.git#<SATP_COMMIT>
9
11
  ```
10
12
 
13
+ The current review package is `@brainai/satp-client@0.0.0-extraction` and
14
+ remains unpublished. Pin a reviewed commit for consumers. Do not publish to npm
15
+ until the release packet passes.
16
+
17
+ Mainnet program IDs are intentionally not enabled in this release candidate.
18
+ Constructors and helpers fail closed for `network: 'mainnet'` until an approved
19
+ mainnet decision packet provides production program IDs.
20
+
21
+ **Runtime dependency:** `@solana/web3.js ^1.98.4`
22
+
11
23
  ## Quick Start
12
24
 
13
- ```js
14
- const { SATPSDK } = require('./src');
25
+ ```javascript
26
+ const { SATPV3SDK } = require('@brainai/satp-client');
27
+
28
+ // Initialize (devnet by default)
29
+ const sdk = new SATPV3SDK({ network: 'devnet' });
30
+
31
+ // Check if an agent has an identity
32
+ const exists = await sdk.hasIdentity('brainChain');
33
+ console.log(exists); // true
34
+
35
+ // Read a Genesis Record
36
+ const record = await sdk.getGenesisRecord('brainChain');
37
+ console.log(record.agentName, record.category, record.isActive);
38
+
39
+ // Build a transaction (unsigned — sign with your wallet)
40
+ const tx = await sdk.buildCreateIdentity(creatorPubkey, 'myAgent', {
41
+ agentName: 'My Agent',
42
+ description: 'An AI agent on Solana',
43
+ category: 'assistant',
44
+ capabilities: ['chat', 'code'],
45
+ metadataUri: 'https://example.com/meta.json',
46
+ });
47
+ // Sign and send tx with your wallet...
48
+ ```
49
+
50
+ ## Architecture
51
+
52
+ ```
53
+ ┌─────────────────────────────────────────────────────────────────┐
54
+ │ SATP V3 SDK │
55
+ ├─────────────┬──────────────┬──────────────┬─────────────────────┤
56
+ │ Identity │ Reviews │ Attestations │ Escrow │
57
+ │ (20 methods)│ (7 methods) │ (3 methods) │ (10 methods) │
58
+ ├─────────────┼──────────────┼──────────────┤ │
59
+ │ Reputation │ Validation │ Migration │ │
60
+ │ (1 method) │ (1 method) │ (1 method) │ │
61
+ ├─────────────┴──────────────┴──────────────┴─────────────────────┤
62
+ │ PDA Derivation │ Borsh Serialization │ RPC Helpers │
63
+ └─────────────────┴───────────────────────┴───────────────────────┘
64
+ ```
65
+
66
+ ## Programs & Program IDs
67
+
68
+ | Program | Devnet | Description |
69
+ |---------|--------|-------------|
70
+ | `identity_v3` | `GTppU4E44BqXTQgbqMZ68ozFzhP1TLty3EGnzzjtNZfG` | Agent identity, names, wallets, face/birth |
71
+ | `reviews_v3` | `r9XX4frcqxxAZ6Au9V5PA3EAxs1zoNckqLLmoSRcNr4` | Peer reviews with 1-5 star ratings |
72
+ | `attestations_v3` | `6Xd1dAQJPvQRJ4Ntr6LtPTjDjPUZ8nfnmYLZaZ2DtrdD` | Third-party attestations & proofs |
73
+ | `reputation_v3` | `2Lz7KzMvKdrGeAuS8WPHu7jK2yScrnKVgacpYVEuDjkJ` | Weighted reputation scoring (CPI → identity) |
74
+ | `validation_v3` | `6rYRiCYidJYV7QvKrzKGgNu4oMh6BAvynked69R7xMbV` | Validation level computation (CPI → identity) |
75
+ | `escrow_v3` | `HXCUWKR2NvRcZ7rNAJHwPcH6QAAWaLR4bRFbfyuDND6C` | SOL escrow for agent jobs |
76
+
77
+ ## API Reference
78
+
79
+ ### Read-only Trust Packet Helpers
80
+
81
+ `buildSatpTrustPacket(opts)` creates a deterministic, offline trust packet for
82
+ consumer preflight and release-packet review. It uses the same inputs as
83
+ `prepareIdentityAttestationRequest`, then includes the derived program IDs,
84
+ Genesis PDA, attestation PDA, request hash, and the unsigned request object.
85
+ The packet is intentionally read-only: `flags.signingRequired`,
86
+ `flags.transactionRequired`, `flags.writesRequired`, and
87
+ `flags.livePaymentRequired` are all `false`; `instructions` and `signers`
88
+ are empty; and `transaction` is `null`.
89
+
90
+ ```javascript
91
+ const {
92
+ buildSatpTrustPacket,
93
+ validateSatpTrustPacket,
94
+ } = require('@brainai/satp-client');
95
+
96
+ const trustPacket = buildSatpTrustPacket({
97
+ subjectWallet: '11111111111111111111111111111111',
98
+ agentId: 'brainChain',
99
+ claimType: 'identity',
100
+ metadataHash: '93d122f8879fe87c186c10a00db8fbc80a73cecd2ede44b9ffa6410be3c2b805',
101
+ network: 'devnet',
102
+ });
103
+
104
+ const validation = validateSatpTrustPacket(trustPacket);
105
+ if (!validation.ok) throw new Error(validation.errors.join('; '));
106
+ ```
107
+
108
+ `validateSatpTrustPacket(packet)` returns `{ ok, errors }`. Validation requires
109
+ `packetType: 'satp-trust-packet'` and
110
+ `mode: 'offline-readonly-trust-packet'`, rejects changed read-only flags, and
111
+ re-derives the expected packet so tampered PDA, program, request, or hash fields
112
+ surface as explicit errors.
113
+
114
+ ### Constructor
115
+
116
+ ```javascript
117
+ const sdk = new SATPV3SDK({ network, rpcUrl });
118
+ // network: 'devnet' (default). 'mainnet' fails closed until approved IDs exist.
119
+ // rpcUrl: optional custom RPC endpoint
120
+ ```
121
+
122
+ ---
123
+
124
+ ### Identity Methods (20)
125
+
126
+ | Method | Description |
127
+ |--------|-------------|
128
+ | `buildCreateIdentity(creator, agentId, meta)` | Create a new agent identity (Genesis Record) |
129
+ | `buildBurnToBecome(authority, agentId, faceImage, faceMint, faceBurnTx)` | Burn NFT to set agent's face (birth ritual) |
130
+ | `buildUpdateIdentity(authority, agentId, updates)` | Update mutable fields (description, capabilities, metadata) |
131
+ | `buildProposeAuthority(authority, agentId, newAuthority)` | Propose authority transfer (2-step) |
132
+ | `buildAcceptAuthority(newAuthority, agentId)` | Accept proposed authority transfer |
133
+ | `buildCancelAuthorityTransfer(authority, agentId)` | Cancel pending authority transfer |
134
+ | `buildRegisterName(authority, agentId, name)` | Register a unique name for an agent |
135
+ | `buildReleaseName(authority, agentId, name)` | Release a registered name |
136
+ | `buildLinkWallet(authority, agentId, wallet, chain, label)` | Link an external wallet to identity |
137
+ | `buildUnlinkWallet(authority, agentId, wallet)` | Unlink an external wallet |
138
+ | `buildInitMintTracker(authority, agentId)` | Initialize NFT mint tracker |
139
+ | `buildRecordMint(authority, agentId)` | Record an NFT mint event |
140
+ | `buildDeactivateIdentity(authority, agentId)` | Deactivate an identity |
141
+ | `buildReactivateIdentity(authority, agentId)` | Reactivate a deactivated identity |
142
+ | `getGenesisRecord(agentId)` | Read a Genesis Record from chain |
143
+ | `hasIdentity(agentId)` | Check if an agent has an identity |
144
+ | `getEscrowPDA(client, description, nonce)` | Derive escrow PDA (sync) |
145
+ | `buildMigrateV2ToV3(v2Authority, agentId, meta)` | Migrate from V2 to V3 identity |
146
+
147
+ #### Genesis Record Fields
148
+
149
+ ```javascript
150
+ const record = await sdk.getGenesisRecord('brainChain');
151
+ // Returns:
152
+ {
153
+ agentIdHash: string, // SHA-256 of agent_id
154
+ agentName: string, // Display name
155
+ description: string, // Agent description
156
+ category: string, // e.g. "developer", "assistant"
157
+ capabilities: string[], // e.g. ["solana", "code"]
158
+ metadataUri: string, // Off-chain metadata URL
159
+ faceImage: string, // Face image URL (after birth)
160
+ faceMint: string, // NFT mint address (after birth)
161
+ faceBurnTx: string, // Burn transaction signature
162
+ genesisRecord: number, // Unix timestamp of birth
163
+ isBorn: boolean, // Whether agent has completed birth ritual
164
+ isActive: boolean, // Whether identity is active
165
+ authority: string, // Current authority pubkey
166
+ pendingAuthority: string | null,
167
+ reputationScore: number, // CPI-updated reputation
168
+ validationLevel: number, // CPI-updated validation
169
+ createdAt: number, // Unix timestamp
170
+ updatedAt: number, // Unix timestamp
171
+ }
172
+ ```
173
+
174
+ ---
175
+
176
+ ### Reviews Methods (7)
177
+
178
+ | Method | Description |
179
+ |--------|-------------|
180
+ | `buildInitReviewCounter(payer, agentId)` | Initialize review counter for an agent |
181
+ | `buildCreateReview(reviewer, agentId, rating, text, metadata, opts)` | Create a 1-5 star review |
182
+ | `buildCreateReviewWithSelfCheck(reviewer, agentId, rating, text, metadata)` | Create review with self-review prevention |
183
+ | `buildUpdateReview(reviewer, reviewPDA, updates)` | Update an existing review |
184
+ | `buildDeleteReview(reviewer, reviewPDA)` | Soft-delete a review |
185
+ | `getReview(agentId, reviewer)` | Read a review from chain |
186
+ | `getReviewCount(agentId)` | Get total review count for an agent |
187
+
188
+ ```javascript
189
+ // Create a review
190
+ const tx = await sdk.buildCreateReview(
191
+ reviewerPubkey,
192
+ 'brainChain', // agent being reviewed
193
+ 5, // rating (1-5)
194
+ 'Excellent Solana dev',
195
+ 'metadata',
196
+ { category: 'development' }
197
+ );
198
+ ```
199
+
200
+ ---
201
+
202
+ ### Attestations Methods (3)
203
+
204
+ | Method | Description |
205
+ |--------|-------------|
206
+ | `buildCreateAttestation(issuer, agentId, type, proofData, expiresAt)` | Issue an attestation |
207
+ | `buildVerifyAttestation(issuer, attestationPDA)` | Mark attestation as verified |
208
+ | `buildRevokeAttestation(issuer, attestationPDA)` | Revoke an attestation |
209
+
210
+ ```javascript
211
+ // Issue a KYC attestation
212
+ const tx = await sdk.buildCreateAttestation(
213
+ issuerPubkey,
214
+ 'brainChain',
215
+ 'kyc', // attestation type
216
+ 'proof-hash-here',
217
+ Math.floor(Date.now()/1000) + 86400 * 365 // expires in 1 year
218
+ );
219
+ ```
220
+
221
+ ---
222
+
223
+ ### Reputation & Validation Methods (2)
224
+
225
+ | Method | Description |
226
+ |--------|-------------|
227
+ | `buildRecomputeReputation(caller, agentId, reviewAccounts)` | Recompute reputation score from reviews (CPI → identity) |
228
+ | `buildRecomputeLevel(caller, agentId, attestationAccounts)` | Recompute validation level from attestations (CPI → identity) |
229
+
230
+ These use Cross-Program Invocation to update fields directly on the Genesis Record.
231
+
232
+ ---
233
+
234
+ ### Escrow Methods (10)
15
235
 
16
- const sdk = new SATPSDK(); // mainnet by default
17
- // const sdk = new SATPSDK({ rpcUrl: 'https://api.devnet.solana.com' });
236
+ Full escrow lifecycle for agent marketplace jobs.
18
237
 
19
- // Check if an agent is registered
20
- const verified = await sdk.verifyAgent('SomeWalletPubkey...');
238
+ | Method | Description |
239
+ |--------|-------------|
240
+ | `buildCreateEscrow(client, agentWallet, agentId, amount, description, deadline, nonce, opts)` | Create SOL escrow for a job |
241
+ | `buildSubmitWork(agent, escrowPDA, workProof)` | Agent submits work proof |
242
+ | `buildEscrowRelease(client, agent, escrowPDA)` | Client releases full payment |
243
+ | `buildPartialRelease(client, agent, escrowPDA, amount)` | Client releases partial payment |
244
+ | `buildCancelEscrow(client, escrowPDA)` | Cancel escrow (refund client) |
245
+ | `buildRaiseDispute(signer, escrowPDA, reason)` | Raise a dispute |
246
+ | `buildResolveDispute(arbiter, agent, client, escrowPDA, agentAmt, clientAmt)` | Arbiter resolves dispute |
247
+ | `buildExtendDeadline(client, escrowPDA, newDeadline)` | Extend job deadline |
248
+ | `buildCloseEscrow(client, escrowPDA)` | Close completed/cancelled escrow (reclaim rent) |
249
+ | `getEscrow(escrowPDA)` | Read escrow state from chain |
21
250
 
22
- // Get identity data
23
- const identity = await sdk.getIdentity('SomeWalletPubkey...');
251
+ #### Escrow Lifecycle
24
252
 
25
- // Get reputation
26
- const rep = await sdk.getReputation('SomeWalletPubkey...');
253
+ ```
254
+ Created WorkSubmitted Released (full or partial)
255
+ ↓ ↓ ↓
256
+ Cancelled Disputed Closed (rent reclaimed)
257
+
258
+ Resolved (split)
259
+
260
+ Closed
261
+ ```
262
+
263
+ ```javascript
264
+ // Create an escrow (0.5 SOL for a coding job)
265
+ const tx = await sdk.buildCreateEscrow(
266
+ clientPubkey,
267
+ agentWallet,
268
+ 'brainChain',
269
+ 0.5 * 1e9, // lamports
270
+ 'Build SATP integration',
271
+ Math.floor(Date.now()/1000) + 86400 * 7, // 7 day deadline
272
+ 0, // nonce (for multiple escrows with same description)
273
+ { arbiter: arbiterPubkey }
274
+ );
275
+ ```
276
+
277
+ ---
278
+
279
+ ### PDA Helpers (exported from `v3-pda.js`)
280
+
281
+ ```javascript
282
+ const {
283
+ hashAgentId, // SHA-256 hash of agent_id string
284
+ hashName, // SHA-256 hash of name string
285
+ getGenesisPDA, // [b"genesis_record", agent_id_hash]
286
+ getNameRegistryPDA, // [b"name_registry_v3", name_hash]
287
+ getLinkedWalletPDA, // [b"linked_wallet_v3", agent_id_hash, wallet]
288
+ getV3MintTrackerPDA, // [b"mint_tracker_v3", agent_id_hash]
289
+ getV3ReviewPDA, // [b"review_v3", agent_id_hash, reviewer]
290
+ getV3ReviewCounterPDA, // [b"review_counter_v3", agent_id_hash]
291
+ getV3AttestationPDA, // [b"attestation_v3", agent_id_hash, issuer, type_hash]
292
+ getV3ReputationAuthorityPDA, // [b"reputation_authority", agent_id_hash]
293
+ getV3ValidationAuthorityPDA, // [b"validation_authority", agent_id_hash]
294
+ getV3EscrowPDA, // [b"escrow_v3", client, desc_hash, nonce_le]
295
+ getV3ProgramIds, // Returns all 6 program IDs for network
296
+ } = require('@brainai/satp-client/src/v3-pda');
297
+ ```
298
+
299
+ ---
300
+
301
+ ### Escrow SDK Utilities (exported from `v3-sdk.js`)
302
+
303
+ ```javascript
304
+ const {
305
+ deriveEscrowPda, // Derive escrow PDA from params
306
+ descriptionHash, // SHA-256 hash of description string
307
+ EscrowStatus, // Enum: { Active: 0, WorkSubmitted: 1, Released: 2, Cancelled: 3, Disputed: 4, Resolved: 5 }
308
+ escrowStatusLabel, // Convert status number to human-readable string
309
+ escrowRemaining, // Calculate remaining escrow balance
310
+ isEscrowExpired, // Check if escrow has passed deadline
311
+ } = require('@brainai/satp-client/src/v3-sdk');
312
+ ```
313
+
314
+ ## Transaction Pattern
315
+
316
+ All `build*` methods return an **unsigned** `Transaction` object. Your application is responsible for:
317
+
318
+ 1. Setting `recentBlockhash` and `feePayer`
319
+ 2. Signing with the appropriate wallet
320
+ 3. Sending to the network
321
+
322
+ ```javascript
323
+ const tx = await sdk.buildCreateIdentity(wallet.publicKey, 'myAgent', { ... });
324
+ tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
325
+ tx.feePayer = wallet.publicKey;
326
+ tx.sign(wallet);
327
+ const sig = await connection.sendRawTransaction(tx.serialize());
328
+ await connection.confirmTransaction(sig);
329
+ ```
330
+
331
+ ## REST API
332
+
333
+ The SATP V3 API is available at `https://agentfolio.bot/api/v3/`:
334
+
335
+ | Endpoint | Description |
336
+ |----------|-------------|
337
+ | `GET /api/v3/health` | API health + program IDs |
338
+ | `GET /api/v3/escrow/by-client/:wallet` | Escrows by client wallet |
339
+ | `GET /api/v3/escrow/by-agent/:wallet` | Escrows by agent wallet |
340
+ | `GET /api/v3/escrow/by-agent-id/:agentId` | Escrows by SATP agent_id |
341
+ | + 18 more | See OpenAPI spec in `docs/` |
342
+
343
+ ## Testing
344
+
345
+ ```bash
346
+ # Unit tests (101)
347
+ node test-v3.js
348
+
349
+ # Devnet integration tests (16)
350
+ node test-v3-devnet.js
351
+
352
+ # CPI integration tests (35)
353
+ cd .. && node tests/devnet-cpi-integration.js
27
354
 
28
- // Derive PDAs (offline, no RPC)
29
- const pdas = sdk.getPDAs('SomeWalletPubkey...');
355
+ # Release-safety defaults and mainnet fail-closed checks
356
+ node test-release-safety.js
30
357
  ```
31
358
 
32
- ## Write Operations (require a signer)
359
+ ## Network Configuration
360
+
361
+ ```javascript
362
+ // Devnet (default)
363
+ const sdk = new SATPV3SDK();
364
+
365
+ // Explicit devnet
366
+ const sdk = new SATPV3SDK({ network: 'devnet' });
367
+
368
+ // Custom RPC
369
+ const sdk = new SATPV3SDK({ rpcUrl: 'https://my-rpc.example.com' });
370
+
371
+ // Mainnet currently fails closed until approved program IDs are configured
372
+ assert.throws(() => new SATPV3SDK({ network: 'mainnet' }));
373
+ ```
374
+
375
+ ## Borsh Deserialization Helpers (v3.6.0)
376
+
377
+ Zero-dependency Borsh deserialization for all 8 SATP V3 account types. Decode raw on-chain data without the `borsh` library.
378
+
379
+ ### Supported Account Types
380
+
381
+ | Account | Program | Deserializer |
382
+ |---------|---------|-------------|
383
+ | GenesisRecord | Identity V3 | `deserializeGenesisRecord(data)` |
384
+ | LinkedWallet | Identity V3 | `deserializeLinkedWallet(data)` |
385
+ | MintTracker | Identity V3 | `deserializeMintTracker(data)` |
386
+ | NameRegistry | Identity V3 | `deserializeNameRegistry(data)` |
387
+ | Review | Reviews V3 | `deserializeReview(data)` |
388
+ | ReviewCounter | Reviews V3 | `deserializeReviewCounter(data)` |
389
+ | Attestation | Attestations V3 | `deserializeAttestation(data)` |
390
+ | EscrowV3 | Escrow V3 | `deserializeEscrowV3(data)` |
391
+
392
+ ### Usage: Typed Deserialization
33
393
 
34
394
  ```js
35
- const { Keypair } = require('@solana/web3.js');
395
+ const { deserializeGenesisRecord, deserializeAttestation } = require('@brainai/satp-client');
396
+ const { Connection, PublicKey } = require('@solana/web3.js');
36
397
 
37
- const signer = Keypair.fromSecretKey(/* your key */);
398
+ const conn = new Connection('https://api.devnet.solana.com');
38
399
 
39
- // Register identity
40
- const sig = await sdk.registerIdentity(signer, 'my-agent', { type: 'ai', version: '1.0' });
400
+ // Fetch raw account and deserialize
401
+ const acct = await conn.getAccountInfo(new PublicKey('...'));
402
+ const genesis = deserializeGenesisRecord(acct.data);
403
+ console.log(genesis.agentName, genesis.reputationScore, genesis.isBorn);
404
+ ```
405
+
406
+ ### Usage: Auto-detect Account Type
41
407
 
42
- // Add reputation (endorser signs)
43
- const sig2 = await sdk.addReputation(endorserKeypair, targetWallet, 100);
408
+ ```js
409
+ const { deserializeAccount } = require('@brainai/satp-client');
410
+
411
+ // Automatically detects type from 8-byte Anchor discriminator
412
+ const { type, data } = deserializeAccount(acct.data);
413
+ console.log(type); // "GenesisRecord" | "Attestation" | "EscrowV3" | ...
414
+ console.log(data); // Fully parsed object
44
415
  ```
45
416
 
46
- ## Transaction Builders (for wallet adapters / frontends)
417
+ ### Usage: Batch Deserialization (getProgramAccounts)
47
418
 
48
419
  ```js
49
- // Get unsigned transaction for frontend signing
50
- const { transaction, identityPDA } = await sdk.buildRegisterIdentity(
51
- walletPublicKey, 'agent-name', { metadata: true }
52
- );
53
- // Sign with wallet adapter, then send
420
+ const { deserializeBatch, DISCRIMINATORS } = require('@brainai/satp-client');
421
+
422
+ const accounts = await conn.getProgramAccounts(REVIEWS_PROGRAM_ID);
423
+ const reviews = deserializeBatch(accounts, 'Review');
424
+ // [{ pubkey: "...", type: "Review", data: { agentId, rating, ... } }, ...]
425
+ ```
426
+
427
+ ### Usage: BorshReader (Custom Deserialization)
428
+
429
+ ```js
430
+ const { BorshReader } = require('@brainai/satp-client');
431
+
432
+ // Low-level reader for custom account layouts
433
+ const r = new BorshReader(acct.data);
434
+ r.skipDiscriminator(); // skip 8-byte Anchor discriminator
435
+ const hash = r.readFixedBytes32(); // [u8; 32]
436
+ const name = r.readString(); // Borsh String
437
+ const items = r.readVecString(); // Vec<String>
438
+ const pk = r.readPubkeyBase58(); // Pubkey → base58
439
+ const opt = r.readOptionI64(); // Option<i64> → number | null
54
440
  ```
55
441
 
56
- ## API
442
+ ### Discriminator Utilities
443
+
444
+ ```js
445
+ const { isAccountType, getAccountDiscriminator, DISCRIMINATORS } = require('@brainai/satp-client');
446
+
447
+ // Check account type before deserializing
448
+ if (isAccountType(acct.data, 'EscrowV3')) {
449
+ const escrow = deserializeEscrowV3(acct.data);
450
+ }
57
451
 
58
- | Method | Type | Description |
59
- |--------|------|-------------|
60
- | `getIdentity(wallet)` | Read | Fetch identity data (or null) |
61
- | `getReputation(wallet)` | Read | Fetch reputation data (or null) |
62
- | `verifyAgent(wallet)` | Read | Check if wallet has SATP identity |
63
- | `getPDAs(wallet)` | Offline | Derive identity + reputation PDAs |
64
- | `registerIdentity(signer, name, metadata)` | Write | Register on-chain identity |
65
- | `addReputation(endorser, target, score)` | Write | Add reputation score |
66
- | `buildRegisterIdentity(wallet, name, meta)` | Builder | Unsigned tx for frontends |
67
- | `buildAddReputation(wallet, score, endorser)` | Builder | Unsigned tx for frontends |
452
+ // Get discriminator for filtering
453
+ const disc = getAccountDiscriminator('Attestation'); // 8-byte Buffer
454
+ // Use with getProgramAccounts memcmp filter
455
+ ```
68
456
 
69
- ## Program IDs (Mainnet)
457
+ ## Security
70
458
 
71
- | Program | Address |
72
- |---------|---------|
73
- | Identity | `BY4jzmnrui1K5gZ5z5xRQkVfEEMXYHYugtH1Ua867eyr` |
74
- | Reputation | `TQ4P9R2Y5FRyw1TZfwoWQ2Mf6XeohbGdhYNcDxh6YYh` |
75
- | Validation | `AdDWFa9oEmZdrTrhu8YTWu4ozbTP7e6qa9rvyqfAvM7N` |
76
- | Escrow | `STyY8w4ZHws3X1AMoocWuDYBoogVDwvymPy8Wifx5TH` |
459
+ - All transactions are returned **unsigned** — the SDK never holds private keys
460
+ - PDA derivation is deterministic and verified against on-chain seeds
461
+ - CPI boundaries enforce program-level authorization
462
+ - Escrow funds are held by PDA-owned accounts (no custodial risk)
77
463
 
78
- ## Notes
464
+ ## License
79
465
 
80
- - Account schemas are best-guess based on Anchor conventions. Once we have the actual IDLs, we can generate exact schemas.
81
- - Write operations require SOL for transaction fees + rent.
82
- - Always test on devnet first: `new SATPSDK({ rpcUrl: 'https://api.devnet.solana.com' })`
466
+ MIT brainAI 2026
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@brainai/satp-client",
3
- "version": "2.0.0",
4
- "description": "SATP v2 Client SDK Solana Agent Token Protocol (Identity, Reviews, Reputation, Attestations, Validation)",
3
+ "version": "2.0.1",
4
+ "description": "SATP client SDK surface prepared for release-candidate review; publish only after the release packet passes.",
5
5
  "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.d.ts",
10
+ "default": "./src/index.js"
11
+ },
12
+ "./src/*": "./src/*",
13
+ "./package.json": "./package.json"
14
+ },
6
15
  "files": [
7
16
  "src/",
8
17
  "README.md"
@@ -23,12 +32,23 @@
23
32
  "license": "MIT",
24
33
  "repository": {
25
34
  "type": "git",
26
- "url": "https://github.com/brainai-dev/satp-client"
35
+ "url": "git+https://github.com/brainAI-bot/satp.git"
36
+ },
37
+ "homepage": "https://github.com/brainAI-bot/satp",
38
+ "engines": {
39
+ "node": ">=20.18"
27
40
  },
28
- "homepage": "https://agentfolio.bot",
29
41
  "dependencies": {
30
42
  "@solana/web3.js": "^1.98.4",
31
43
  "borsh": "^2.0.0",
32
44
  "bs58": "^6.0.0"
45
+ },
46
+ "private": false,
47
+ "overrides": {
48
+ "ws": "^8.20.1"
49
+ },
50
+ "publishConfig": {
51
+ "tag": "rc",
52
+ "access": "public"
33
53
  }
34
54
  }