Skip to content

Commit 90b4528

Browse files
committed
1.0.0
1 parent 40ecf55 commit 90b4528

File tree

3 files changed

+15
-28
lines changed

3 files changed

+15
-28
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@open-agent-economy/trust-sdk",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "TypeScript SDK for Open Agent Trust & Reputation Protocol",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ export class AgentTrustSDK {
101101
* Register a new interaction between two agents
102102
* Returns the transaction hash
103103
*/
104-
async registerInteraction(params: RegisterInteractionParams): Promise<{interactionId: string, txHash: string}> {
104+
async registerInteraction(
105+
params: RegisterInteractionParams
106+
): Promise<{ interactionId: string; txHash: string }> {
105107
if (!this.signer) throw new Error('Signer required for write operations');
106108

107109
const agentA = await this.getAgentId();
@@ -128,11 +130,9 @@ export class AgentTrustSDK {
128130
const eventFragment = this.interactionRegistry.interface.getEvent('InteractionRegistered');
129131
if (!eventFragment) throw new Error('InteractionRegistered event not found');
130132

131-
const event = receipt.logs.find((log: any) =>
132-
log.topics[0] === eventFragment.topicHash
133-
);
133+
const event = receipt.logs.find((log: any) => log.topics[0] === eventFragment.topicHash);
134134

135-
return {interactionId: event?.topics[1] || '', txHash: receipt.hash}; // Return interaction ID
135+
return { interactionId: event?.topics[1] || '', txHash: receipt.hash }; // Return interaction ID
136136
}
137137

138138
/**
@@ -187,9 +187,7 @@ export class AgentTrustSDK {
187187
const eventFragment = this.schemaRegistry.interface.getEvent('SchemaRegistered');
188188
if (!eventFragment) throw new Error('SchemaRegistered event not found');
189189

190-
const event = receipt.logs.find((log: any) =>
191-
log.topics[0] === eventFragment.topicHash
192-
);
190+
const event = receipt.logs.find((log: any) => log.topics[0] === eventFragment.topicHash);
193191

194192
return event?.topics[1] || ''; // Return schema ID
195193
}
@@ -314,11 +312,7 @@ export class AgentTrustSDK {
314312
/**
315313
* Get attestations by tag
316314
*/
317-
async getAttestationsByTag(
318-
agentId: bigint,
319-
namespace: string,
320-
tag: string
321-
): Promise<string[]> {
315+
async getAttestationsByTag(agentId: bigint, namespace: string, tag: string): Promise<string[]> {
322316
return await this.trustGraph.getAttestationsByTag(agentId, namespace, tag);
323317
}
324318

@@ -341,21 +335,15 @@ export class AgentTrustSDK {
341335
const attestationIds = await this.getAttestations(agentId);
342336

343337
// Fetch all attestation details
344-
const attestations = await Promise.all(
345-
attestationIds.map(id => this.getAttestation(id))
346-
);
338+
const attestations = await Promise.all(attestationIds.map((id) => this.getAttestation(id)));
347339

348340
// Filter by namespace/tag if specified
349341
let filteredAttestations = attestations;
350342
if (query?.namespace) {
351-
filteredAttestations = filteredAttestations.filter(
352-
a => a.namespace === query.namespace
353-
);
343+
filteredAttestations = filteredAttestations.filter((a) => a.namespace === query.namespace);
354344
}
355345
if (query?.tag) {
356-
filteredAttestations = filteredAttestations.filter(
357-
a => a.tag === query.tag
358-
);
346+
filteredAttestations = filteredAttestations.filter((a) => a.tag === query.tag);
359347
}
360348

361349
// Group by category
@@ -374,9 +362,8 @@ export class AgentTrustSDK {
374362

375363
// Calculate overall (simple average for now)
376364
const allScores = Object.values(categoryScores);
377-
const overall = allScores.length > 0
378-
? allScores.reduce((a, b) => a + b, 0) / allScores.length
379-
: 0;
365+
const overall =
366+
allScores.length > 0 ? allScores.reduce((a, b) => a + b, 0) / allScores.length : 0;
380367

381368
// Simple decay factor (1% per day, simplified)
382369
const decayFactor = 0.98;

0 commit comments

Comments
 (0)