All methods are async and return Promise<T>. All errors extend WraithError.
new WraithClient({
connection: Connection, // required
cluster?: Cluster, // 'mainnet-beta' (default) | 'devnet' | 'testnet' | 'localnet'
programId?: PublicKey, // override program ID
indexerUrl?: string, // default 'https://indexer.wraith.dev'
commitment?: Commitment, // default 'confirmed'
})client.ping(): Promise<{ ok: true; version: string; cluster: Cluster }>Health-check. Returns indexer version on success, throws on network error.
client.agents.register({
name: string,
description?: string,
scopes: AgentScope[],
signer: Keypair,
nonce?: Uint8Array,
}): Promise<Agent>Throws if scopes is empty or contains a malformed scope string.
client.agents.get(id: AgentId): Promise<Agent>Throws AgentNotFoundError (HTTP 404).
client.agents.list({
owner?: PublicKey,
limit?: number, // 1..200, default 50
cursor?: string,
}): Promise<{ agents: Agent[]; cursor: string | null }>client.agents.update(id, { name?, description? }, signer): Promise<Agent>Coming Q2 2026.
client.agents.transfer(id, newOwner: PublicKey, signer): Promise<void>Coming Q2 2026.
client.bonds.create({
agentId: AgentId,
amount: number, // SOL, must be >= 0.1
signer: Keypair,
}): Promise<Bond>Throws InsufficientBondError if amount is below the protocol minimum (0.1 SOL). Throws if signer balance is below amount.
Standard read endpoints.
client.proofs.submit({
agentId: AgentId,
taskId: string,
commitHash: string, // 32-byte hex (64 chars)
signer: Keypair, // agent's action key, NOT owner's
}): Promise<Proof>The signer is the agent's dedicated action key, which is different from the owner's wallet. Action keys are derived deterministically from the owner's wallet via BIP32 paths — see Agents docs.
client.proofs.verify(id: ProofId): Promise<boolean>Returns true only if the signature is valid AND the agent is currently bonded. Throws ProofVerificationError on indexer errors.
client.claims.file({
agentId: AgentId,
bondId: BondId,
reason: string, // 16..256 chars
evidence: ClaimEvidence,
signer: Keypair,
}): Promise<Claim>evidence.description is required. txSignature and proofId are optional but strongly recommended — claims without supporting evidence are dismissed by default.
Validator-only. Throws if signer is not in the active validator set.
Anyone can call. Triggers on-chain payout for a claim with a settled verdict (review window expired and votes tallied).
client.pricing.estimate({ scopes }): Promise<PricingEstimate>Falls back to local computation if the indexer is unreachable.
client.pricing.getRates(): Promise<Record<string, number>>Canonical scope-weight table. Throws on network error (no fallback — if you need this, you need the canonical version).
Aggregate read endpoints for building dashboards.
client.dashboard.trustScore(agentId): Promise<TrustScoreRecord>
client.dashboard.health(): Promise<BondHealth>
client.dashboard.alerts(): Promise<Alert[]>import {
WraithError,
AgentNotFoundError,
InsufficientBondError,
ClaimRejectedError,
ProofVerificationError,
} from '@wraith/sdk';Every error has a name matching the class. Catch the base WraithError to handle anything from the SDK without missing edge cases:
try {
await client.bonds.create({ ... });
} catch (err) {
if (err instanceof WraithError) {
console.error(err.name, err.message);
} else {
throw err;
}
}