@hankolabs/sdk
v0.1.2
Published
TypeScript SDK for the HANKO Solana Agent Trust Registry. Look up trust, register agents, post attestations, and query karma.
Downloads
436
Maintainers
Readme
@hankolabs/sdk
TypeScript SDK for the HANKO Solana Agent Trust Registry — an ERC-8004 port to Solana with Identity, Reputation, and Validation registries plus Stake/Slash and a Karma score.
Look up an agent's trust report, read karma breakdowns, derive on-chain PDAs, and sign or verify reputation attestations locally.
Install
npm install @hankolabs/sdkQuick start
import { HankoClient } from "@hankolabs/sdk";
import { PublicKey } from "@solana/web3.js";
const hanko = new HankoClient();
// Full trust report (server-cached ~60s)
const report = await hanko.verify("8N3v...JkGf");
console.log(report.status, report.karma.score, report.karma.tier);
// Karma breakdown
const karma = await hanko.karma("8N3v...JkGf");
// Top-N leaderboard
const top = await hanko.leaderboard(50);Configuration
const hanko = new HankoClient({
apiUrl: "https://api.hanko.network", // default
rpcUrl: "https://api.mainnet-beta.solana.com", // default
programId: new PublicKey("YfTrap5ZjuEv8mfcRBFvGDuxXvhrpLvfmLEJZQxYpg2"), // default
});The default program id is the deployed HANKO registry
(YfTrap5ZjuEv8mfcRBFvGDuxXvhrpLvfmLEJZQxYpg2).
PDAs
const [identity] = hanko.identityPda(agentPubkey); // seeds: ["agent", agent]
const [bond] = hanko.bondPda(agentPubkey); // seeds: ["bond", agent]
const [attest] = hanko.attestationPda(agentPubkey, clientPubkey); // ["attest", agent, client]
const [config] = hanko.configPda(); // seeds: ["config"]Attestations
signAttestation and verifyAttestation re-export the canonical Ed25519 layout
from @hankolabs/attestation-engine.
To post an attestation on-chain, submit the Ed25519 SigVerify instruction and the
post_attestation instruction in the same transaction.
const { signature, message } = hanko.signAttestation({
agent, client, score: 90, tagBitmap: 0b1n, uriHash, nonce: 1n, secretKey,
});API
| Method | Description |
| ------ | ----------- |
| verify(agent) | Full TrustReport for an agent. |
| karma(agent) | KarmaBreakdown for an agent. |
| leaderboard(limit?) | Top-N karma leaderboard. |
| identityPda(agent) / bondPda(agent) / attestationPda(agent, client) / configPda() | Derive program PDAs. |
| signAttestation(params) / verifyAttestation(params) | Local Ed25519 attestation sign/verify. |
| validationCommitment(expectedHash, salt) | sha256(expected_hash \|\| salt) for the Validation Registry. |
License
MIT
