@arc402/sdk 0.2.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.
- package/README.md +184 -0
- package/dist/agent.d.ts +29 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +95 -0
- package/dist/agreement.d.ts +57 -0
- package/dist/agreement.d.ts.map +1 -0
- package/dist/agreement.js +156 -0
- package/dist/capability.d.ts +17 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +19 -0
- package/dist/channel.d.ts +39 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +160 -0
- package/dist/coldstart.d.ts +15 -0
- package/dist/coldstart.d.ts.map +1 -0
- package/dist/coldstart.js +44 -0
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +2 -0
- package/dist/contractinteraction.d.ts +47 -0
- package/dist/contractinteraction.d.ts.map +1 -0
- package/dist/contractinteraction.js +80 -0
- package/dist/contracts.d.ts +27 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +187 -0
- package/dist/deliverable.d.ts +118 -0
- package/dist/deliverable.d.ts.map +1 -0
- package/dist/deliverable.js +156 -0
- package/dist/dispute-arbitration.d.ts +42 -0
- package/dist/dispute-arbitration.d.ts.map +1 -0
- package/dist/dispute-arbitration.js +160 -0
- package/dist/governance.d.ts +13 -0
- package/dist/governance.d.ts.map +1 -0
- package/dist/governance.js +15 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +92 -0
- package/dist/intent.d.ts +13 -0
- package/dist/intent.d.ts.map +1 -0
- package/dist/intent.js +26 -0
- package/dist/metadata.d.ts +55 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +106 -0
- package/dist/migration.d.ts +11 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +38 -0
- package/dist/multiparty.d.ts +56 -0
- package/dist/multiparty.d.ts.map +1 -0
- package/dist/multiparty.js +86 -0
- package/dist/negotiation-guard.d.ts +20 -0
- package/dist/negotiation-guard.d.ts.map +1 -0
- package/dist/negotiation-guard.js +96 -0
- package/dist/negotiation.d.ts +25 -0
- package/dist/negotiation.d.ts.map +1 -0
- package/dist/negotiation.js +102 -0
- package/dist/policy.d.ts +33 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +72 -0
- package/dist/reputation.d.ts +13 -0
- package/dist/reputation.d.ts.map +1 -0
- package/dist/reputation.js +21 -0
- package/dist/session-manager.d.ts +13 -0
- package/dist/session-manager.d.ts.map +1 -0
- package/dist/session-manager.js +102 -0
- package/dist/settlement.d.ts +14 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +35 -0
- package/dist/sponsorship.d.ts +17 -0
- package/dist/sponsorship.d.ts.map +1 -0
- package/dist/sponsorship.js +19 -0
- package/dist/trust.d.ts +22 -0
- package/dist/trust.d.ts.map +1 -0
- package/dist/trust.js +52 -0
- package/dist/types.d.ts +391 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +119 -0
- package/dist/wallet.d.ts +31 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +83 -0
- package/dist/watchtower.d.ts +60 -0
- package/dist/watchtower.d.ts.map +1 -0
- package/dist/watchtower.js +93 -0
- package/package.json +30 -0
- package/src/agent.ts +122 -0
- package/src/agreement.ts +236 -0
- package/src/capability.ts +18 -0
- package/src/channel.ts +203 -0
- package/src/coldstart.ts +52 -0
- package/src/context.ts +2 -0
- package/src/contractinteraction.d.ts +47 -0
- package/src/contractinteraction.d.ts.map +1 -0
- package/src/contractinteraction.js +81 -0
- package/src/contractinteraction.js.map +1 -0
- package/src/contractinteraction.ts +157 -0
- package/src/contracts.d.ts +27 -0
- package/src/contracts.d.ts.map +1 -0
- package/src/contracts.js +188 -0
- package/src/contracts.js.map +1 -0
- package/src/contracts.ts +186 -0
- package/src/deliverable.ts +231 -0
- package/src/demos/demo-insurance.ts +148 -0
- package/src/demos/demo-multiagent.ts +197 -0
- package/src/demos/demo-research.ts +124 -0
- package/src/dispute-arbitration.ts +196 -0
- package/src/governance.ts +14 -0
- package/src/index.ts +31 -0
- package/src/intent.ts +22 -0
- package/src/metadata.ts +158 -0
- package/src/migration.ts +43 -0
- package/src/multiparty.ts +132 -0
- package/src/negotiation-guard.ts +125 -0
- package/src/negotiation.ts +135 -0
- package/src/policy.ts +71 -0
- package/src/reputation.ts +20 -0
- package/src/session-manager.ts +80 -0
- package/src/settlement.ts +31 -0
- package/src/sponsorship.ts +18 -0
- package/src/trust.ts +43 -0
- package/src/types.d.ts +391 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +113 -0
- package/src/types.js.map +1 -0
- package/src/types.ts +484 -0
- package/src/wallet.ts +86 -0
- package/src/watchtower.ts +124 -0
- package/test/negotiation-signing.test.js +157 -0
- package/test/sdk.test.js +19 -0
- package/tsconfig.json +17 -0
package/src/policy.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ContractRunner, ethers } from "ethers";
|
|
2
|
+
import { POLICY_ENGINE_ABI } from "./contracts";
|
|
3
|
+
import { Policy } from "./types";
|
|
4
|
+
|
|
5
|
+
export class PolicyClient {
|
|
6
|
+
private contract: ethers.Contract;
|
|
7
|
+
constructor(address: string, runner: ContractRunner) { this.contract = new ethers.Contract(address, POLICY_ENGINE_ABI, runner); }
|
|
8
|
+
async set(walletAddress: string, categories: Record<string, bigint>) {
|
|
9
|
+
const policyData = JSON.stringify(Object.fromEntries(Object.entries(categories).map(([k, v]) => [k, v.toString()])));
|
|
10
|
+
const tx = await this.contract.setPolicy(ethers.keccak256(ethers.toUtf8Bytes(policyData)), ethers.toUtf8Bytes(policyData));
|
|
11
|
+
await tx.wait();
|
|
12
|
+
for (const [category, limit] of Object.entries(categories)) {
|
|
13
|
+
const updateTx = await this.contract.setCategoryLimitFor(walletAddress, category, limit);
|
|
14
|
+
await updateTx.wait();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async get(walletAddress: string): Promise<Policy> {
|
|
18
|
+
const [policyHash, policyDataBytes] = await this.contract.getPolicy(walletAddress);
|
|
19
|
+
const categories: Policy["categories"] = {};
|
|
20
|
+
if (policyDataBytes && policyDataBytes !== "0x") {
|
|
21
|
+
const parsed = JSON.parse(ethers.toUtf8String(policyDataBytes));
|
|
22
|
+
for (const [key, value] of Object.entries(parsed)) categories[key] = { limitPerTx: BigInt(value as string) };
|
|
23
|
+
}
|
|
24
|
+
return { walletAddress, policyHash, categories };
|
|
25
|
+
}
|
|
26
|
+
async validate(walletAddress: string, category: string, amount: bigint) {
|
|
27
|
+
const [valid, reason] = await this.contract.validateSpend(walletAddress, category, amount, ethers.ZeroHash);
|
|
28
|
+
return { valid, reason: valid ? undefined : reason };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Freeze spend for a wallet. Callable by the wallet, its owner, or an authorized freeze agent. */
|
|
32
|
+
async freezeSpend(wallet: string): Promise<ethers.TransactionReceipt> {
|
|
33
|
+
const tx = await this.contract.freezeSpend(wallet);
|
|
34
|
+
return (await tx.wait())!;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Unfreeze spend for a wallet. Only callable by the wallet or its registered owner. */
|
|
38
|
+
async unfreeze(wallet: string): Promise<ethers.TransactionReceipt> {
|
|
39
|
+
const tx = await this.contract.unfreeze(wallet);
|
|
40
|
+
return (await tx.wait())!;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Authorize a watchtower agent to freeze this wallet's spending. Caller must be the wallet. */
|
|
44
|
+
async authorizeFreezeAgent(agent: string): Promise<ethers.TransactionReceipt> {
|
|
45
|
+
const tx = await this.contract.authorizeFreezeAgent(agent);
|
|
46
|
+
return (await tx.wait())!;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Revoke a watchtower agent's freeze authorization. */
|
|
50
|
+
async revokeFreezeAgent(agent: string): Promise<ethers.TransactionReceipt> {
|
|
51
|
+
const tx = await this.contract.revokeFreezeAgent(agent);
|
|
52
|
+
return (await tx.wait())!;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Queue a daily-limit reduction for wallet+category. Only reductions (newCap < current) are allowed.
|
|
57
|
+
* A 24-hour timelock applies before the new cap can be applied.
|
|
58
|
+
*/
|
|
59
|
+
async queueCapReduction(wallet: string, category: string, newCap: bigint): Promise<ethers.TransactionReceipt> {
|
|
60
|
+
const tx = await this.contract.queueCapReduction(wallet, category, newCap);
|
|
61
|
+
return (await tx.wait())!;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Apply a queued cap reduction after the 24-hour timelock has elapsed. */
|
|
65
|
+
async applyCapReduction(wallet: string, category: string): Promise<ethers.TransactionReceipt> {
|
|
66
|
+
const tx = await this.contract.applyCapReduction(wallet, category);
|
|
67
|
+
return (await tx.wait())!;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export class PolicyObject extends PolicyClient {}
|
|
71
|
+
export class PolicyValidator { static validate(policy: Policy, category: string, amount: bigint) { return !!policy.categories[category] && amount <= policy.categories[category].limitPerTx; } }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ContractRunner, ethers } from "ethers";
|
|
2
|
+
import { REPUTATION_ORACLE_ABI } from "./contracts";
|
|
3
|
+
import { ReputationSignal, ReputationSignalType, ReputationSummary } from "./types";
|
|
4
|
+
|
|
5
|
+
export class ReputationOracleClient {
|
|
6
|
+
private contract: ethers.Contract;
|
|
7
|
+
constructor(address: string, runner: ContractRunner) { this.contract = new ethers.Contract(address, REPUTATION_ORACLE_ABI, runner); }
|
|
8
|
+
async publishSignal(subject: string, signalType: ReputationSignalType, capabilityHash = ethers.ZeroHash, reason = "") { const tx = await this.contract.publishSignal(subject, signalType, capabilityHash, reason); return tx.wait(); }
|
|
9
|
+
async getReputation(subject: string): Promise<ReputationSummary> {
|
|
10
|
+
const [endorsements, warnings, blocks, weightedScore] = await this.contract.getReputation(subject);
|
|
11
|
+
return { endorsements: BigInt(endorsements), warnings: BigInt(warnings), blocks: BigInt(blocks), weightedScore: BigInt(weightedScore) };
|
|
12
|
+
}
|
|
13
|
+
getCapabilityReputation(subject: string, capabilityHash: string) { return this.contract.getCapabilityReputation(subject, capabilityHash).then(BigInt); }
|
|
14
|
+
getSignalCount(subject: string) { return this.contract.getSignalCount(subject).then(BigInt); }
|
|
15
|
+
async getSignal(subject: string, index: bigint): Promise<ReputationSignal> {
|
|
16
|
+
const raw = await this.contract.getSignal(subject, index);
|
|
17
|
+
return { publisher: raw.publisher, subject: raw.subject, signalType: Number(raw.signalType) as ReputationSignalType, capabilityHash: raw.capabilityHash, reason: raw.reason, publisherTrustAtTime: BigInt(raw.publisherTrustAtTime), timestamp: BigInt(raw.timestamp), autoPublished: raw.autoPublished };
|
|
18
|
+
}
|
|
19
|
+
async listSignals(subject: string): Promise<ReputationSignal[]> { const count = Number(await this.getSignalCount(subject)); return Promise.all(Array.from({ length: count }, (_, i) => this.getSignal(subject, BigInt(i)))); }
|
|
20
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
import { ethers } from "ethers";
|
|
5
|
+
import type { NegotiationMessage, NegotiationSession } from "./types";
|
|
6
|
+
|
|
7
|
+
const SESSIONS_DIR = path.join(os.homedir(), ".arc402", "sessions");
|
|
8
|
+
|
|
9
|
+
export class SessionManager {
|
|
10
|
+
constructor(private sessionsDir = SESSIONS_DIR) {
|
|
11
|
+
fs.mkdirSync(this.sessionsDir, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
createSession(initiator: string, responder: string): NegotiationSession {
|
|
15
|
+
const nonce = ethers.hexlify(ethers.randomBytes(16));
|
|
16
|
+
const sessionId = ethers.keccak256(
|
|
17
|
+
ethers.AbiCoder.defaultAbiCoder().encode(
|
|
18
|
+
["address", "address", "uint256", "bytes16"],
|
|
19
|
+
[initiator, responder, Math.floor(Date.now() / 1000), nonce]
|
|
20
|
+
)
|
|
21
|
+
) as `0x${string}`;
|
|
22
|
+
const session: NegotiationSession = {
|
|
23
|
+
sessionId,
|
|
24
|
+
initiator: initiator as `0x${string}`,
|
|
25
|
+
responder: responder as `0x${string}`,
|
|
26
|
+
createdAt: Math.floor(Date.now() / 1000),
|
|
27
|
+
messages: [],
|
|
28
|
+
state: "OPEN",
|
|
29
|
+
};
|
|
30
|
+
this.save(session);
|
|
31
|
+
return session;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
addMessage(sessionId: string, message: NegotiationMessage): void {
|
|
35
|
+
const session = this.load(sessionId);
|
|
36
|
+
session.messages.push(message);
|
|
37
|
+
if (message.type === "ACCEPT") {
|
|
38
|
+
session.state = "ACCEPTED";
|
|
39
|
+
session.agreedPrice = message.agreedPrice;
|
|
40
|
+
session.agreedDeadline = message.agreedDeadline;
|
|
41
|
+
session.transcriptHash = this.computeTranscriptHash(session.messages);
|
|
42
|
+
}
|
|
43
|
+
if (message.type === "REJECT") {
|
|
44
|
+
session.state = "REJECTED";
|
|
45
|
+
session.transcriptHash = this.computeTranscriptHash(session.messages);
|
|
46
|
+
}
|
|
47
|
+
this.save(session);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
computeTranscriptHash(messages: NegotiationMessage[]): `0x${string}` {
|
|
51
|
+
const transcript = JSON.stringify(messages);
|
|
52
|
+
return ethers.keccak256(ethers.toUtf8Bytes(transcript)) as `0x${string}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
load(sessionId: string): NegotiationSession {
|
|
56
|
+
const file = path.join(this.sessionsDir, `${sessionId}.json`);
|
|
57
|
+
if (!fs.existsSync(file)) throw new Error(`Session not found: ${sessionId}`);
|
|
58
|
+
return JSON.parse(fs.readFileSync(file, "utf8")) as NegotiationSession;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
save(session: NegotiationSession): void {
|
|
62
|
+
fs.writeFileSync(
|
|
63
|
+
path.join(this.sessionsDir, `${session.sessionId}.json`),
|
|
64
|
+
JSON.stringify(session, null, 2)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
list(): NegotiationSession[] {
|
|
69
|
+
if (!fs.existsSync(this.sessionsDir)) return [];
|
|
70
|
+
return fs.readdirSync(this.sessionsDir)
|
|
71
|
+
.filter(f => f.endsWith(".json"))
|
|
72
|
+
.map(f => JSON.parse(fs.readFileSync(path.join(this.sessionsDir, f), "utf8")) as NegotiationSession);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setOnChainId(sessionId: string, agreementId: string): void {
|
|
76
|
+
const session = this.load(sessionId);
|
|
77
|
+
session.onChainAgreementId = agreementId;
|
|
78
|
+
this.save(session);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ContractRunner, ethers } from "ethers";
|
|
2
|
+
import { SETTLEMENT_COORDINATOR_ABI } from "./contracts";
|
|
3
|
+
import { SettlementProposal, SettlementStatus } from "./types";
|
|
4
|
+
|
|
5
|
+
const STATUS_MAP: SettlementStatus[] = ["PENDING", "ACCEPTED", "REJECTED", "EXECUTED", "EXPIRED"];
|
|
6
|
+
|
|
7
|
+
export class SettlementClient {
|
|
8
|
+
private contract: ethers.Contract;
|
|
9
|
+
constructor(address: string, runner: ContractRunner) { this.contract = new ethers.Contract(address, SETTLEMENT_COORDINATOR_ABI, runner); }
|
|
10
|
+
async propose(fromWallet: string, toWallet: string, amount: bigint, intentId: string, ttlSeconds = 3600) {
|
|
11
|
+
const expiresAt = Math.floor(Date.now() / 1000) + ttlSeconds;
|
|
12
|
+
const tx = await this.contract.propose(fromWallet, toWallet, amount, intentId, expiresAt);
|
|
13
|
+
const receipt = await tx.wait();
|
|
14
|
+
const iface = new ethers.Interface(SETTLEMENT_COORDINATOR_ABI);
|
|
15
|
+
for (const log of receipt.logs) {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = iface.parseLog(log);
|
|
18
|
+
if (parsed?.name === "ProposalCreated") return parsed.args.proposalId as string;
|
|
19
|
+
} catch {}
|
|
20
|
+
}
|
|
21
|
+
throw new Error("Could not parse proposalId from receipt");
|
|
22
|
+
}
|
|
23
|
+
async accept(id: string) { const tx = await this.contract.accept(id); return tx.wait(); }
|
|
24
|
+
async reject(id: string, reason: string) { const tx = await this.contract.reject(id, reason); return tx.wait(); }
|
|
25
|
+
async execute(id: string) { const proposal = await this.getProposal(id); const tx = await this.contract.execute(id, { value: proposal.amount }); return tx.wait(); }
|
|
26
|
+
async getProposal(id: string): Promise<SettlementProposal> {
|
|
27
|
+
const [from, to, amount, intentId, expiresAt, statusNum, rejectionReason] = await this.contract.getProposal(id);
|
|
28
|
+
return { proposalId: id, from, to, amount: BigInt(amount), intentId, expiresAt: Number(expiresAt), status: STATUS_MAP[Number(statusNum)] ?? "PENDING", rejectionReason };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class MultiAgentSettlement extends SettlementClient {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ContractRunner, ethers } from "ethers";
|
|
2
|
+
import { SPONSORSHIP_ATTESTATION_ABI } from "./contracts";
|
|
3
|
+
import { IdentityTier, SponsorshipAttestationRecord } from "./types";
|
|
4
|
+
|
|
5
|
+
export class SponsorshipAttestationClient {
|
|
6
|
+
private contract: ethers.Contract;
|
|
7
|
+
constructor(address: string, runner: ContractRunner) { this.contract = new ethers.Contract(address, SPONSORSHIP_ATTESTATION_ABI, runner); }
|
|
8
|
+
async publish(agent: string, expiresAt = 0) { const tx = await this.contract.publish(agent, expiresAt); return tx.wait(); }
|
|
9
|
+
async publishWithTier(agent: string, expiresAt: number, tier: IdentityTier, evidenceURI = "") { const tx = await this.contract.publishWithTier(agent, expiresAt, tier, evidenceURI); return tx.wait(); }
|
|
10
|
+
async revoke(attestationId: string) { const tx = await this.contract.revoke(attestationId); return tx.wait(); }
|
|
11
|
+
isActive(attestationId: string) { return this.contract.isActive(attestationId); }
|
|
12
|
+
getActiveAttestation(sponsor: string, agent: string) { return this.contract.getActiveAttestation(sponsor, agent); }
|
|
13
|
+
async getAttestation(attestationId: string): Promise<SponsorshipAttestationRecord> { const raw = await this.contract.getAttestation(attestationId); return { sponsor: raw.sponsor, agent: raw.agent, issuedAt: BigInt(raw.issuedAt), expiresAt: BigInt(raw.expiresAt), revoked: raw.revoked, tier: Number(raw.tier) as IdentityTier, evidenceURI: raw.evidenceURI }; }
|
|
14
|
+
getSponsorAttestations(sponsor: string) { return this.contract.getSponsorAttestations(sponsor); }
|
|
15
|
+
getAgentAttestations(agent: string) { return this.contract.getAgentAttestations(agent); }
|
|
16
|
+
activeSponsorCount(sponsor: string) { return this.contract.activeSponsorCount(sponsor).then(BigInt); }
|
|
17
|
+
getHighestTier(agent: string) { return this.contract.getHighestTier(agent).then((value: bigint) => Number(value) as IdentityTier); }
|
|
18
|
+
}
|
package/src/trust.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ContractRunner, ethers } from "ethers";
|
|
2
|
+
import { TRUST_REGISTRY_ABI } from "./contracts";
|
|
3
|
+
import { TrustScore } from "./types";
|
|
4
|
+
|
|
5
|
+
function getTrustLevel(score: number): TrustScore["level"] {
|
|
6
|
+
if (score < 100) return "probationary";
|
|
7
|
+
if (score < 300) return "restricted";
|
|
8
|
+
if (score < 600) return "standard";
|
|
9
|
+
if (score < 800) return "elevated";
|
|
10
|
+
return "autonomous";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getNextLevelAt(score: number): number {
|
|
14
|
+
if (score < 100) return 100;
|
|
15
|
+
if (score < 300) return 300;
|
|
16
|
+
if (score < 600) return 600;
|
|
17
|
+
if (score < 800) return 800;
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class TrustClient {
|
|
22
|
+
private contract: ethers.Contract;
|
|
23
|
+
constructor(address: string, runner: ContractRunner) { this.contract = new ethers.Contract(address, TRUST_REGISTRY_ABI, runner); }
|
|
24
|
+
async getScore(walletAddress: string): Promise<TrustScore> {
|
|
25
|
+
const score = Number(await this.contract.getScore(walletAddress));
|
|
26
|
+
return { score, level: getTrustLevel(score), nextLevelAt: getNextLevelAt(score) };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the effective trust score for a wallet, accounting for any decay or bonus adjustments
|
|
31
|
+
* applied by the TrustRegistry (e.g. velocity bonuses, anomaly penalties).
|
|
32
|
+
* Prefer this over getScore for policy decisions.
|
|
33
|
+
*/
|
|
34
|
+
async getEffectiveScore(walletAddress: string): Promise<TrustScore> {
|
|
35
|
+
const score = Number(await this.contract.getEffectiveScore(walletAddress));
|
|
36
|
+
return { score, level: getTrustLevel(score), nextLevelAt: getNextLevelAt(score) };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async init(walletAddress: string) { const tx = await this.contract.initWallet(walletAddress); return tx.wait(); }
|
|
40
|
+
getTrustLevel = getTrustLevel;
|
|
41
|
+
getNextLevelAt = getNextLevelAt;
|
|
42
|
+
}
|
|
43
|
+
export class TrustPrimitive extends TrustClient {}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
export type Address = string;
|
|
2
|
+
export type Hex = string;
|
|
3
|
+
export interface CategoryLimit {
|
|
4
|
+
limitPerTx: bigint;
|
|
5
|
+
}
|
|
6
|
+
export interface Policy {
|
|
7
|
+
walletAddress: Address;
|
|
8
|
+
policyHash?: Hex;
|
|
9
|
+
categories: Record<string, CategoryLimit>;
|
|
10
|
+
}
|
|
11
|
+
export interface Context {
|
|
12
|
+
contextId: Hex;
|
|
13
|
+
taskType: string;
|
|
14
|
+
openedAt: number;
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface TrustScore {
|
|
18
|
+
score: number;
|
|
19
|
+
level: "probationary" | "restricted" | "standard" | "elevated" | "autonomous";
|
|
20
|
+
nextLevelAt: number;
|
|
21
|
+
}
|
|
22
|
+
export interface Intent {
|
|
23
|
+
attestationId: Hex;
|
|
24
|
+
action: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
recipient: Address;
|
|
27
|
+
amount: bigint;
|
|
28
|
+
wallet: Address;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
31
|
+
export type SettlementStatus = "PENDING" | "ACCEPTED" | "REJECTED" | "EXECUTED" | "EXPIRED";
|
|
32
|
+
export interface SettlementProposal {
|
|
33
|
+
proposalId: Hex;
|
|
34
|
+
from: Address;
|
|
35
|
+
to: Address;
|
|
36
|
+
amount: bigint;
|
|
37
|
+
intentId: Hex;
|
|
38
|
+
expiresAt: number;
|
|
39
|
+
status: SettlementStatus;
|
|
40
|
+
rejectionReason?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ContractAddresses {
|
|
43
|
+
policyEngine: Address;
|
|
44
|
+
trustRegistry: Address;
|
|
45
|
+
intentAttestation: Address;
|
|
46
|
+
settlementCoordinator: Address;
|
|
47
|
+
walletFactory?: Address;
|
|
48
|
+
agentRegistry?: Address;
|
|
49
|
+
serviceAgreement?: Address;
|
|
50
|
+
reputationOracle?: Address;
|
|
51
|
+
sponsorshipAttestation?: Address;
|
|
52
|
+
capabilityRegistry?: Address;
|
|
53
|
+
governance?: Address;
|
|
54
|
+
}
|
|
55
|
+
export interface NetworkConfig {
|
|
56
|
+
chainId: number;
|
|
57
|
+
rpc: string;
|
|
58
|
+
contracts: ContractAddresses;
|
|
59
|
+
}
|
|
60
|
+
export declare const NETWORKS: Record<string, NetworkConfig>;
|
|
61
|
+
export interface AgentInfo {
|
|
62
|
+
wallet: Address;
|
|
63
|
+
name: string;
|
|
64
|
+
capabilities: string[];
|
|
65
|
+
serviceType: string;
|
|
66
|
+
endpoint: string;
|
|
67
|
+
metadataURI: string;
|
|
68
|
+
active: boolean;
|
|
69
|
+
registeredAt: bigint;
|
|
70
|
+
endpointChangedAt: bigint;
|
|
71
|
+
endpointChangeCount: bigint;
|
|
72
|
+
trustScore?: bigint;
|
|
73
|
+
}
|
|
74
|
+
export interface OperationalMetrics {
|
|
75
|
+
heartbeatInterval: bigint;
|
|
76
|
+
heartbeatGracePeriod: bigint;
|
|
77
|
+
lastHeartbeatAt: bigint;
|
|
78
|
+
rollingLatency: bigint;
|
|
79
|
+
heartbeatCount: bigint;
|
|
80
|
+
missedHeartbeatCount: bigint;
|
|
81
|
+
uptimeScore: bigint;
|
|
82
|
+
responseScore: bigint;
|
|
83
|
+
}
|
|
84
|
+
export declare enum AgreementStatus {
|
|
85
|
+
PROPOSED = 0,
|
|
86
|
+
ACCEPTED = 1,
|
|
87
|
+
PENDING_VERIFICATION = 2,
|
|
88
|
+
FULFILLED = 3,
|
|
89
|
+
DISPUTED = 4,
|
|
90
|
+
CANCELLED = 5,
|
|
91
|
+
REVISION_REQUESTED = 6,
|
|
92
|
+
REVISED = 7,
|
|
93
|
+
PARTIAL_SETTLEMENT = 8,
|
|
94
|
+
MUTUAL_CANCEL = 9,
|
|
95
|
+
ESCALATED_TO_HUMAN = 10,
|
|
96
|
+
ESCALATED_TO_ARBITRATION = 11
|
|
97
|
+
}
|
|
98
|
+
export declare enum ProviderResponseType {
|
|
99
|
+
NONE = 0,
|
|
100
|
+
REVISE = 1,
|
|
101
|
+
DEFEND = 2,
|
|
102
|
+
COUNTER = 3,
|
|
103
|
+
PARTIAL_SETTLEMENT = 4,
|
|
104
|
+
REQUEST_HUMAN_REVIEW = 5,
|
|
105
|
+
ESCALATE = 6
|
|
106
|
+
}
|
|
107
|
+
export declare enum DisputeOutcome {
|
|
108
|
+
NONE = 0,
|
|
109
|
+
PENDING = 1,
|
|
110
|
+
PROVIDER_WINS = 2,
|
|
111
|
+
CLIENT_REFUND = 3,
|
|
112
|
+
PARTIAL_PROVIDER = 4,
|
|
113
|
+
PARTIAL_CLIENT = 5,
|
|
114
|
+
MUTUAL_CANCEL = 6,
|
|
115
|
+
HUMAN_REVIEW_REQUIRED = 7
|
|
116
|
+
}
|
|
117
|
+
export declare enum EvidenceType {
|
|
118
|
+
NONE = 0,
|
|
119
|
+
TRANSCRIPT = 1,
|
|
120
|
+
DELIVERABLE = 2,
|
|
121
|
+
ACCEPTANCE_CRITERIA = 3,
|
|
122
|
+
COMMUNICATION = 4,
|
|
123
|
+
EXTERNAL_REFERENCE = 5,
|
|
124
|
+
OTHER = 6
|
|
125
|
+
}
|
|
126
|
+
export declare enum DirectDisputeReason {
|
|
127
|
+
NONE = 0,
|
|
128
|
+
NO_DELIVERY = 1,
|
|
129
|
+
HARD_DEADLINE_BREACH = 2,
|
|
130
|
+
INVALID_OR_FRAUDULENT_DELIVERABLE = 3,
|
|
131
|
+
SAFETY_CRITICAL_VIOLATION = 4
|
|
132
|
+
}
|
|
133
|
+
export interface Agreement {
|
|
134
|
+
id: bigint;
|
|
135
|
+
client: Address;
|
|
136
|
+
provider: Address;
|
|
137
|
+
serviceType: string;
|
|
138
|
+
description: string;
|
|
139
|
+
price: bigint;
|
|
140
|
+
token: Address;
|
|
141
|
+
deadline: bigint;
|
|
142
|
+
deliverablesHash: Hex;
|
|
143
|
+
status: AgreementStatus;
|
|
144
|
+
createdAt: bigint;
|
|
145
|
+
resolvedAt: bigint;
|
|
146
|
+
verifyWindowEnd: bigint;
|
|
147
|
+
committedHash: Hex;
|
|
148
|
+
}
|
|
149
|
+
export interface ProposeParams {
|
|
150
|
+
provider: Address;
|
|
151
|
+
serviceType: string;
|
|
152
|
+
description: string;
|
|
153
|
+
price: bigint;
|
|
154
|
+
token: Address;
|
|
155
|
+
deadline: number;
|
|
156
|
+
deliverablesHash: Hex;
|
|
157
|
+
}
|
|
158
|
+
export interface RemediationCase {
|
|
159
|
+
cycleCount: number;
|
|
160
|
+
openedAt: bigint;
|
|
161
|
+
deadlineAt: bigint;
|
|
162
|
+
lastActionAt: bigint;
|
|
163
|
+
latestTranscriptHash: Hex;
|
|
164
|
+
active: boolean;
|
|
165
|
+
}
|
|
166
|
+
export interface RemediationFeedback {
|
|
167
|
+
cycle: number;
|
|
168
|
+
author: Address;
|
|
169
|
+
feedbackHash: Hex;
|
|
170
|
+
feedbackURI: string;
|
|
171
|
+
previousTranscriptHash: Hex;
|
|
172
|
+
transcriptHash: Hex;
|
|
173
|
+
timestamp: bigint;
|
|
174
|
+
}
|
|
175
|
+
export interface RemediationResponse {
|
|
176
|
+
cycle: number;
|
|
177
|
+
author: Address;
|
|
178
|
+
responseType: ProviderResponseType;
|
|
179
|
+
proposedProviderPayout: bigint;
|
|
180
|
+
responseHash: Hex;
|
|
181
|
+
responseURI: string;
|
|
182
|
+
previousTranscriptHash: Hex;
|
|
183
|
+
transcriptHash: Hex;
|
|
184
|
+
timestamp: bigint;
|
|
185
|
+
}
|
|
186
|
+
export interface DisputeCase {
|
|
187
|
+
agreementId: bigint;
|
|
188
|
+
openedAt: bigint;
|
|
189
|
+
responseDeadlineAt: bigint;
|
|
190
|
+
outcome: DisputeOutcome;
|
|
191
|
+
providerAward: bigint;
|
|
192
|
+
clientAward: bigint;
|
|
193
|
+
humanReviewRequested: boolean;
|
|
194
|
+
evidenceCount: bigint;
|
|
195
|
+
}
|
|
196
|
+
export interface DisputeEvidence {
|
|
197
|
+
submitter: Address;
|
|
198
|
+
evidenceType: EvidenceType;
|
|
199
|
+
evidenceHash: Hex;
|
|
200
|
+
evidenceURI: string;
|
|
201
|
+
timestamp: bigint;
|
|
202
|
+
}
|
|
203
|
+
export declare enum ArbitrationVote {
|
|
204
|
+
NONE = 0,
|
|
205
|
+
PROVIDER_WINS = 1,
|
|
206
|
+
CLIENT_REFUND = 2,
|
|
207
|
+
SPLIT = 3,
|
|
208
|
+
HUMAN_REVIEW_REQUIRED = 4
|
|
209
|
+
}
|
|
210
|
+
export interface ArbitrationCase {
|
|
211
|
+
agreementId: bigint;
|
|
212
|
+
arbitrators: Address[];
|
|
213
|
+
arbitratorCount: number;
|
|
214
|
+
providerVotes: number;
|
|
215
|
+
clientVotes: number;
|
|
216
|
+
splitVotes: number;
|
|
217
|
+
humanVotes: number;
|
|
218
|
+
selectionDeadlineAt: bigint;
|
|
219
|
+
decisionDeadlineAt: bigint;
|
|
220
|
+
splitProviderAward: bigint;
|
|
221
|
+
splitClientAward: bigint;
|
|
222
|
+
finalized: boolean;
|
|
223
|
+
humanBackstopUsed: boolean;
|
|
224
|
+
}
|
|
225
|
+
export declare enum ReputationSignalType {
|
|
226
|
+
ENDORSE = 0,
|
|
227
|
+
WARN = 1,
|
|
228
|
+
BLOCK = 2
|
|
229
|
+
}
|
|
230
|
+
export interface ReputationSignal {
|
|
231
|
+
publisher: Address;
|
|
232
|
+
subject: Address;
|
|
233
|
+
signalType: ReputationSignalType;
|
|
234
|
+
capabilityHash: Hex;
|
|
235
|
+
reason: string;
|
|
236
|
+
publisherTrustAtTime: bigint;
|
|
237
|
+
timestamp: bigint;
|
|
238
|
+
autoPublished: boolean;
|
|
239
|
+
}
|
|
240
|
+
export interface ReputationSummary {
|
|
241
|
+
endorsements: bigint;
|
|
242
|
+
warnings: bigint;
|
|
243
|
+
blocks: bigint;
|
|
244
|
+
weightedScore: bigint;
|
|
245
|
+
}
|
|
246
|
+
export declare enum IdentityTier {
|
|
247
|
+
NONE = 0,
|
|
248
|
+
SPONSORED = 1,
|
|
249
|
+
VERIFIED_PROVIDER = 2,
|
|
250
|
+
ENTERPRISE_PROVIDER = 3
|
|
251
|
+
}
|
|
252
|
+
export interface SponsorshipAttestationRecord {
|
|
253
|
+
sponsor: Address;
|
|
254
|
+
agent: Address;
|
|
255
|
+
issuedAt: bigint;
|
|
256
|
+
expiresAt: bigint;
|
|
257
|
+
revoked: boolean;
|
|
258
|
+
tier: IdentityTier;
|
|
259
|
+
evidenceURI: string;
|
|
260
|
+
}
|
|
261
|
+
export interface CapabilityRoot {
|
|
262
|
+
root: string;
|
|
263
|
+
rootId: Hex;
|
|
264
|
+
active: boolean;
|
|
265
|
+
}
|
|
266
|
+
export interface GovernanceTransaction {
|
|
267
|
+
target: Address;
|
|
268
|
+
value: bigint;
|
|
269
|
+
data: Hex;
|
|
270
|
+
executed: boolean;
|
|
271
|
+
confirmationCount: bigint;
|
|
272
|
+
}
|
|
273
|
+
export interface NegotiationMessageBase {
|
|
274
|
+
from: Address;
|
|
275
|
+
to: Address;
|
|
276
|
+
timestamp: number;
|
|
277
|
+
sig: Hex;
|
|
278
|
+
}
|
|
279
|
+
export interface NegotiationProposal extends NegotiationMessageBase {
|
|
280
|
+
type: "PROPOSE";
|
|
281
|
+
serviceType: string;
|
|
282
|
+
price: string;
|
|
283
|
+
token: Address;
|
|
284
|
+
deadline: string;
|
|
285
|
+
spec: string;
|
|
286
|
+
specHash: Hex;
|
|
287
|
+
nonce: Hex;
|
|
288
|
+
expiresAt: number;
|
|
289
|
+
}
|
|
290
|
+
export interface NegotiationCounter extends NegotiationMessageBase {
|
|
291
|
+
type: "COUNTER";
|
|
292
|
+
price?: string;
|
|
293
|
+
deadline?: string;
|
|
294
|
+
justification: string;
|
|
295
|
+
refNonce: Hex;
|
|
296
|
+
}
|
|
297
|
+
export interface NegotiationAccept extends NegotiationMessageBase {
|
|
298
|
+
type: "ACCEPT";
|
|
299
|
+
agreedPrice: string;
|
|
300
|
+
agreedDeadline: string;
|
|
301
|
+
refNonce: Hex;
|
|
302
|
+
}
|
|
303
|
+
export interface NegotiationReject extends NegotiationMessageBase {
|
|
304
|
+
type: "REJECT";
|
|
305
|
+
reason: string;
|
|
306
|
+
refNonce?: Hex;
|
|
307
|
+
}
|
|
308
|
+
export type NegotiationMessage = NegotiationProposal | NegotiationCounter | NegotiationAccept | NegotiationReject;
|
|
309
|
+
export interface NegotiationSession {
|
|
310
|
+
sessionId: Hex;
|
|
311
|
+
initiator: Address;
|
|
312
|
+
responder: Address;
|
|
313
|
+
createdAt: number;
|
|
314
|
+
messages: NegotiationMessage[];
|
|
315
|
+
state: "OPEN" | "ACCEPTED" | "REJECTED" | "EXPIRED";
|
|
316
|
+
transcriptHash?: Hex;
|
|
317
|
+
agreedPrice?: string;
|
|
318
|
+
agreedDeadline?: string;
|
|
319
|
+
onChainAgreementId?: string;
|
|
320
|
+
}
|
|
321
|
+
export interface SignedNegotiationMessage<T extends NegotiationMessage = NegotiationMessage> {
|
|
322
|
+
message: T;
|
|
323
|
+
recoveredSigner: Address;
|
|
324
|
+
}
|
|
325
|
+
export type NegotiationVerificationError = "INVALID_SIGNATURE" | "SIGNER_NOT_REGISTERED" | "TIMESTAMP_TOO_OLD" | "TIMESTAMP_IN_FUTURE" | "NONCE_REPLAYED" | "MESSAGE_EXPIRED" | "MESSAGE_TOO_LARGE" | "SCHEMA_INVALID";
|
|
326
|
+
export interface NegotiationVerificationResult {
|
|
327
|
+
valid: boolean;
|
|
328
|
+
error?: NegotiationVerificationError;
|
|
329
|
+
recoveredSigner?: Address;
|
|
330
|
+
}
|
|
331
|
+
export declare enum DisputeMode {
|
|
332
|
+
UNILATERAL = 0,
|
|
333
|
+
MUTUAL = 1
|
|
334
|
+
}
|
|
335
|
+
export declare enum DisputeClass {
|
|
336
|
+
HARD_FAILURE = 0,
|
|
337
|
+
AMBIGUITY_QUALITY = 1,
|
|
338
|
+
HIGH_SENSITIVITY = 2
|
|
339
|
+
}
|
|
340
|
+
export interface DisputeFeeState {
|
|
341
|
+
mode: DisputeMode;
|
|
342
|
+
disputeClass: DisputeClass;
|
|
343
|
+
opener: string;
|
|
344
|
+
client: string;
|
|
345
|
+
provider: string;
|
|
346
|
+
token: string;
|
|
347
|
+
agreementPrice: bigint;
|
|
348
|
+
feeRequired: bigint;
|
|
349
|
+
openerPaid: bigint;
|
|
350
|
+
respondentPaid: bigint;
|
|
351
|
+
openedAt: bigint;
|
|
352
|
+
active: boolean;
|
|
353
|
+
resolved: boolean;
|
|
354
|
+
}
|
|
355
|
+
export interface ArbitratorBondState {
|
|
356
|
+
bondAmount: bigint;
|
|
357
|
+
lockedAt: bigint;
|
|
358
|
+
locked: boolean;
|
|
359
|
+
slashed: boolean;
|
|
360
|
+
returned: boolean;
|
|
361
|
+
}
|
|
362
|
+
export type ChannelStatus = 'OPEN' | 'CLOSING' | 'CHALLENGED' | 'SETTLED';
|
|
363
|
+
export interface ChannelState {
|
|
364
|
+
channelId: string;
|
|
365
|
+
sequenceNumber: number;
|
|
366
|
+
callCount: number;
|
|
367
|
+
cumulativePayment: bigint;
|
|
368
|
+
token: string;
|
|
369
|
+
timestamp: number;
|
|
370
|
+
clientSig?: string;
|
|
371
|
+
providerSig?: string;
|
|
372
|
+
}
|
|
373
|
+
export interface Channel {
|
|
374
|
+
client: string;
|
|
375
|
+
provider: string;
|
|
376
|
+
token: string;
|
|
377
|
+
depositAmount: bigint;
|
|
378
|
+
settledAmount: bigint;
|
|
379
|
+
lastSequenceNumber: number;
|
|
380
|
+
deadline: number;
|
|
381
|
+
challengeExpiry: number;
|
|
382
|
+
status: ChannelStatus;
|
|
383
|
+
}
|
|
384
|
+
export interface OpenChannelParams {
|
|
385
|
+
provider: string;
|
|
386
|
+
token: string;
|
|
387
|
+
maxAmount: bigint;
|
|
388
|
+
ratePerCall: bigint;
|
|
389
|
+
deadline: number;
|
|
390
|
+
}
|
|
391
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,MAAM;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE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