Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add blockmatic/basilic --skill viem-v2git clone --depth 1 https://github.com/blockmatic/basilicWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/blockmatic/basilic/viem-v2)<a href="https://agentmods.dev/skills/blockmatic/basilic/viem-v2"><img src="https://agentmods.dev/badge/skills/blockmatic/basilic/viem-v2.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00069 | $0.02000 |
| Opus 5 | $0.00034 | $0.01000 |
| Sonnet 5 | $0.00014 | $0.00400 |
| Haiku 4.5 | $0.00007 | $0.00200 |
Grade A, and why
viem-v2 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
86% identical to viem-integration — 12 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 277 lines — stays where its author put it; the contents beside it link to each section on GitHub.
viem Integration
Integrate EVM blockchains using viem for TypeScript/JavaScript applications.
Wallet UI: React wallet connect and hooks belong in wagmi-v3. Do not add wagmi to an app that has no wallet UI yet. Use viem directly for backends, scripts, and address/signature verification.
Quick Decision Guide
| Building... | Use This |
|---|---|
| Node.js script/backend | viem with http transport |
| React/Next.js frontend | wagmi hooks (built on viem) |
| Real-time event monitoring | viem with webSocket transport |
| Browser wallet integration | wagmi or viem custom transport |
Installation
# Core library
npm install viem
# For React apps, also install wagmi
npm install wagmi viem @tanstack/react-query
Core Concepts
Clients
viem uses two client types:
| Client | Purpose | Example Use |
|---|---|---|
| PublicClient | Read-only operations | Get balances, read contracts, fetch logs |
| WalletClient | Write operations | Send transactions, sign messages |
Transports
| Transport | Use Case |
|---|---|
http() |
Standard RPC calls (most common) |
webSocket() |
Real-time event subscriptions |
custom() |
Browser wallets (window.ethereum) |
Chains
viem includes 50+ chain definitions. Import from viem/chains:
import { mainnet, arbitrum, optimism, base, polygon } from 'viem/chains';
Input Validation Rules
Before interpolating ANY user-provided value into generated TypeScript code:
- Ethereum addresses: MUST match
^0x[a-fA-F0-9]{40}$— use viem'sisAddress()for validation - Chain IDs: MUST be from viem's supported chain definitions
- Private keys: MUST NEVER be hardcoded — always use
process.env.PRIVATE_KEYwith runtime validation - RPC URLs: MUST use
https://orwss://protocols only - ABI inputs: Validate types match expected Solidity types before encoding
What ships with it
6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 277 lines · 69 tokens per session scan A 58aa2960f02a
viem-v2 is a skill published in the GitHub repository blockmatic/basilic (89 stars, last pushed yesterday), licensed MIT. It adds 69 tokens to every session and 2,000 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to viem-integration, differing in 12 lines, and is treated as a copy.
Other skills, from other repositories
starknet-js
Use when writing or debugging JavaScript/TypeScript that interacts with Starknet through the starknet.js SDK — building Call objects or calldata, encoding/decoding Cairo types (felt252, u256, structs, arrays, spans, ByteArray, Option/Result/custom enums), or working with contracts, accounts, providers, transactions…
viem-integration
Integrate EVM blockchains using viem. Use when user says "read blockchain data", "send transaction", "interact with smart contract", "connect to Ethereum", "use viem", "use wagmi", "wallet integration", "viem setup", or mentions blockchain/EVM development with TypeScript.
wallet-cli
Operate the TypeScript TRON wallet CLI for accounts, transfers, staking, governance, contracts, signing, chain queries, and password input with wallet-cli 4.13.0. Refuse wallet passwords in argv and require the supported stdin channel. For Java REPL requests, refuse that entry and offer the TypeScript one-shot CLI…
upgrade-viem
Input: optionally a target viem version. Without one, use the latest release on npm.
solana
Use when working on Solana software, including one or more of: Solana client code using TypeScript, Rust libraries that use Solana crates, Anchor programs, Quasar programs, LiteSVM tests, including Rust program files, TypeScript tests, and Anchor.toml or Quasar.toml configuration. Designed to create minimal, reusable…
bnb-chain-toolkit-guide
Guide to the BNB Chain Toolkit — a modular TypeScript toolkit for building, deploying, and interacting with smart contracts on BNB Chain. Includes BEP-20 token utilities, DeFi integrations, wallet management, and cross-chain bridging. Built for BNB Chain Hackathon by the Sperax team.