@veritynpm/sdk
v0.1.12
Published
TypeScript SDK for querying Verity Protocol agent scores and EAS attestations
Readme
@veritynpm/sdk
TypeScript SDK for Verity Protocol — on-chain reliability scoring for autonomous agents.
Scores agents 0–1000 across Economic, Solver, Governance, and Base Layer verticals. Every score is attested on-chain via EAS on Base.
Install
npm install @veritynpm/sdk
# or
pnpm add @veritynpm/sdkZero dependencies. ESM only — requires "type": "module" or a bundler. Works in Node.js and the browser via native fetch.
Quick start
import { VerityClient } from '@veritynpm/sdk'
const verity = new VerityClient({
baseUrl: 'https://verity.tenpound.xyz',
})
const score = await verity.getScore('virtuals', '0xYourProviderAddress')
console.log(score.verticals[0].score) // 0–1000
console.log(score.verticals[0].confidenceBand) // 'insufficient' | 'low' | 'moderate' | 'high'
console.log(score.attestation?.easUid) // EAS UID on BaseAPI
getScore(registryType, platformId)
Public — no payment required. Returns the latest Reliability Index per vertical and the most recent EAS attestation UID.
const score = await verity.getScore('erc8004', '42')
for (const v of score.verticals) {
console.log(`${v.vertical}: ${v.score} (${v.confidenceBand})`)
}
// economic: 720 (moderate)
// base_layer: 540 (low)getBreakdown(registryType, platformId, opts?)
Full signal breakdown — BSS, ROI, bot fingerprint, copy-trade detection, consistency. Gated behind x402 ($0.01 USDC on Base) in production. Bypassed on localhost.
import { VerityPaymentRequiredError } from '@veritynpm/sdk'
try {
const breakdown = await verity.getBreakdown('virtuals', '0xabc...')
console.log(breakdown.breakdown[0].bssRaw)
} catch (err) {
if (err instanceof VerityPaymentRequiredError) {
console.log('Payment required:', err.x402Details)
}
}verifyAttestation(easUid)
Verifies an EAS attestation directly on Base — does not call the Verity API.
const score = await verity.getScore('erc8004', '42')
const uid = score.attestation?.easUid
if (uid) {
const attest = await verity.verifyAttestation(uid)
if (attest && !attest.revoked) {
console.log('Verified on Base:', attest.id)
}
}Gating pattern
import { VerityClient, VerityNotFoundError } from '@veritynpm/sdk'
const verity = new VerityClient({ baseUrl: 'https://verity.tenpound.xyz' })
async function isEligible(registryType, platformId) {
try {
const score = await verity.getScore(registryType, platformId)
const economic = score.verticals.find(v => v.vertical === 'economic')
if (!economic) return false
return (
economic.score >= 600 &&
['moderate', 'high'].includes(economic.confidenceBand) &&
!!score.attestation
)
} catch (err) {
if (err instanceof VerityNotFoundError) return false
throw err
}
}Registry types
| registryType | platformId | Verticals |
|---|---|---|
| virtuals | Provider wallet address (0x…) | Economic |
| erc8004 | ERC-721 token ID (uint256) | Economic, Base Layer, Solver |
| warden | Space ID (uint64 string) | Solver |
| fetchai | Agentverse address (agent1q…) | Base Layer |
| wallet | EVM wallet address (0x…) | Economic, Governance |
| olas | Olas token ID (uint256) | Base Layer |
Error handling
import { VerityError, VerityNotFoundError, VerityPaymentRequiredError } from '@veritynpm/sdk'
try {
const score = await verity.getScore(registryType, platformId)
} catch (err) {
if (err instanceof VerityNotFoundError) {
console.log('Agent not indexed:', err.hint)
} else if (err instanceof VerityPaymentRequiredError) {
console.log('x402 payment required:', err.x402Details)
} else if (err instanceof VerityError) {
console.log('API error:', err.status, err.message)
}
}Links
- Docs: verity.tenpound.xyz/docs
- npm: @veritynpm/sdk
- EAS attestations: base.easscan.org
