@vouch-protocol/sdk
v0.1.3
Published
TypeScript SDK for the KYA on-chain identity and trust protocol on Solana
Maintainers
Readme
@vouch-protocol/sdk
TypeScript SDK for the Vouch on-chain identity and trust protocol on Solana.
Install
npm install @vouch-protocol/sdkQuick Start
import { RegistryClient, VaultClient, VOUCH_PROGRAM_ID } from "@vouch-protocol/sdk";
import { AnchorProvider, Program } from "@coral-xyz/anchor";
// Initialize clients
const provider = AnchorProvider.env();
const program = new Program(idl, VOUCH_PROGRAM_ID, provider);
const registry = new RegistryClient(program, provider);
const vault = new VaultClient(program, provider);
// Register an AI agent
await registry.registerAgent({
owner: wallet.publicKey,
name: "MyAgent",
serviceCategory: { commerce: {} },
agentCardUrl: "https://example.com/.well-known/agent.json",
agentCardHash: hash,
});
// Deposit USDC stake
await vault.deposit({
owner: wallet.publicKey,
agentPda,
ownerTokenAccount,
vaultTokenAccount,
amount: 100_000_000, // 100 USDC
});
// Fetch agent identity
const agent = await registry.fetchAgent(agentPda);
console.log(agent.tier, agent.reputationScore);Features
- Agent Registry — register, update, verify, and deactivate AI agent identities
- Stake Vault — deposit/withdraw USDC stake with tiered trust levels
- DID Resolution — W3C
did:soldocument generation and resolution - Verifiable Credentials — issue and verify agent credentials
- On-chain Verification — CPI-compatible agent eligibility checks
API Reference
RegistryClient
| Method | Description |
|--------|-------------|
| registerAgent() | Register a new AI agent on-chain |
| updateAgent() | Update agent capabilities, name, or agent card |
| suspendAgent() | Suspend an agent (owner or admin) |
| reactivateAgent() | Reactivate a suspended agent |
| deactivateAgent() | Permanently deactivate an agent |
| closeAgent() | Close a deactivated agent and reclaim rent |
| closeDeactivationRecord() | Close deactivation record after 30-day grace period |
| verifyAgent() | Verify agent identity and active status |
| checkAgentEligibility() | Get structured agent profile via CPI |
| fetchAgent() | Fetch agent account data |
| resolveAgentByDid() | Resolve a did:sol URI to an agent |
| generateDidDocument() | Generate W3C DID Document for an agent |
VaultClient
| Method | Description |
|--------|-------------|
| deposit() | Deposit USDC stake (auto-upgrades tier) |
| requestWithdrawal() | Request withdrawal with cooldown timer |
| completeWithdrawal() | Complete withdrawal after cooldown |
| cancelWithdrawal() | Cancel a pending withdrawal |
| closeStake() | Close an empty stake account |
| fetchStakeAccount() | Fetch stake account data |
| fetchWithdrawalRequest() | Fetch pending withdrawal |
License
MIT
