npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@maiat/viem-guard

v0.2.0

Published

Agentic trust layer for viem — trust scoring, anti-poisoning, TrustGateHook integration, and threat reporting

Readme

@maiat/viem-guard v0.2.0

Agentic trust layer for viem — trust scoring, anti-poisoning, TrustGateHook integration, and threat reporting.

Install

npm install @maiat/viem-guard viem

Quick Start

import { createWalletClient, http, parseEther } from 'viem'
import { base } from 'viem/chains'
import { withMaiatTrust } from '@maiat/viem-guard'

const client = withMaiatTrust(walletClient, {
  minScore: 60,
  antiPoison: true,       // detect address poisoning
  reportThreats: true,    // auto-report to Maiat network
})

await client.sendTransaction({
  to: '0xSomeContract',
  value: parseEther('1'),
})

Agent Wallet (Privy / EIP-1193)

One-line integration for AI agent wallets:

import { createMaiatAgentWallet } from '@maiat/viem-guard'

const wallet = createMaiatAgentWallet(privyProvider, {
  minScore: 70,
  antiPoison: true,
  apiKey: 'mk_...',
})

// All transactions: trust-gated + anti-poisoned + threat-reported
await wallet.sendTransaction({ to, value })

TrustGateHook Integration (Uniswap V4)

Fetch EIP-712 signed scores for TrustGateHook-protected pools:

import { fetchSignedScore, encodeSwapHookData } from '@maiat/viem-guard'

// Fetch signed trust scores for both tokens
const score0 = await fetchSignedScore('0xToken0Address')
const score1 = await fetchSignedScore('0xToken1Address')

if (score0 && score1) {
  const hookData = encodeSwapHookData(myAddress, score0, score1)
  // Pass hookData to your Uniswap V4 swap transaction
}

Anti-Poisoning Engine

Detects address poisoning attacks before they happen:

  • Vanity Match Detection: Scans wallet history for addresses with matching first4+last4 hex chars
  • Liveness Check: Flags accounts created <24h ago with dust-only transactions
const client = withMaiatTrust(walletClient, {
  antiPoison: {
    vanityMatch: true,
    livenessCheck: true,
    etherscanApiKey: 'YOUR_KEY',
    explorerUrl: 'https://api.basescan.org/api',
  },
})

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | minScore | number | 60 | Block if trust score below threshold | | apiKey | string | - | mk_... key for paid tier | | mode | 'block' \| 'warn' \| 'silent' | 'block' | How to handle low-trust | | onWarn | (result) => void | - | Called in warn mode | | recordOutcomes | boolean | false | Record tx outcomes to Maiat | | antiPoison | boolean \| AntiPoisonConfig | false | Enable anti-poisoning | | reportThreats | boolean | true | Auto-report threats to network | | routerAddresses | string[] | - | Uniswap V4 router addresses | | feeTarget | string | - | Address for fee discount |

Error Handling

import { withMaiatTrust, MaiatTrustError, MaiatPoisonError } from '@maiat/viem-guard'

try {
  await client.sendTransaction({ to: '0x...', value: parseEther('1') })
} catch (e) {
  if (e instanceof MaiatPoisonError) {
    console.log(e.threatType)      // 'vanity_match' | 'dust_liveness'
    console.log(e.matchedAddress)  // the real address being impersonated
  }
  if (e instanceof MaiatTrustError) {
    console.log(e.score)           // 0-100
    console.log(e.verdict)         // 'block'
  }
}

Collective Immunity

When Guard blocks an attack, it automatically reports the malicious address to the Maiat network (privacy-safe — no sender context). Every Maiat-protected agent gets instant protection.

Agent A blocks attack → Report to Maiat → Global TrustScore update → All agents immunized

Exports

// Core
export { withMaiatTrust } from '@maiat/viem-guard'
export { createMaiatAgentWallet } from '@maiat/viem-guard'

// Hook Data
export { fetchSignedScore, encodeSwapHookData } from '@maiat/viem-guard'

// Anti-Poisoning
export { detectVanityMatch } from '@maiat/viem-guard'

// Threat Reporting
export { reportThreat } from '@maiat/viem-guard'

// Trust Check
export { checkTrust } from '@maiat/viem-guard'

// Types & Errors
export { MaiatTrustError, MaiatPoisonError } from '@maiat/viem-guard'
export type { MaiatCheckResult, SignedScore, AntiPoisonConfig, ThreatReport } from '@maiat/viem-guard'

Powered by

Maiat Protocol — trust infrastructure for agentic commerce