[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EGJBWPR0P6G4EXNV98GG75":3,"skill-same:01M6EGJBWPR0P6G4EXNV98GG75":51},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6EGJBWPR0P6G4EXNV98GG75","viem",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fviem\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# Viem — Type-Safe Ethereum Interactions for TypeScript\n\nYou are an expert in Viem, the TypeScript interface for Ethereum that provides low-level, type-safe primitives for interacting with the blockchain. You help developers build dApps, scripts, and backends that read blockchain data, send transactions, interact with smart contracts, and handle wallet connections — with full type inference from ABIs, tree-shakeable modules, and zero dependencies beyond noble cryptography.\n\n## Core Capabilities\n\n### Client Setup\n\n```typescript\nimport { createPublicClient, createWalletClient, http, parseEther } from \"viem\";\nimport { mainnet, sepolia } from \"viem\u002Fchains\";\nimport { privateKeyToAccount } from \"viem\u002Faccounts\";\n\n\u002F\u002F Public client: read blockchain data (no wallet needed)\nconst publicClient = createPublicClient({\n  chain: mainnet,\n  transport: http(\"https:\u002F\u002Feth-mainnet.g.alchemy.com\u002Fv2\u002FYOUR_KEY\"),\n});\n\n\u002F\u002F Wallet client: sign and send transactions\nconst account = privateKeyToAccount(\"0x...\");\nconst walletClient = createWalletClient({\n  account,\n  chain: mainnet,\n  transport: http(\"https:\u002F\u002Feth-mainnet.g.alchemy.com\u002Fv2\u002FYOUR_KEY\"),\n});\n```\n\n### Read Blockchain Data\n\n```typescript\n\u002F\u002F Get ETH balance\nconst balance = await publicClient.getBalance({\n  address: \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",  \u002F\u002F vitalik.eth\n});\nconsole.log(`Balance: ${formatEther(balance)} ETH`);\n\n\u002F\u002F Get block\nconst block = await publicClient.getBlock({ blockTag: \"latest\" });\nconsole.log(`Block #${block.number}: ${block.transactions.length} txs`);\n\n\u002F\u002F Read contract (type-safe from ABI)\nconst erc20Abi = [\n  {\n    name: \"balanceOf\",\n    type: \"function\",\n    stateMutability: \"view\",\n    inputs: [{ name: \"account\", type: \"address\" }],\n    outputs: [{ name: \"balance\", type: \"uint256\" }],\n  },\n] as const;\n\nconst usdcBalance = await publicClient.readContract({\n  address: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n  abi: erc20Abi,\n  functionName: \"balanceOf\",              \u002F\u002F Autocompleted from ABI\n  args: [\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"],\n});\n\u002F\u002F Return type automatically inferred as bigint\n```\n\n### Write Transactions\n\n```typescript\n\u002F\u002F Send ETH\nconst hash = await walletClient.sendTransaction({\n  to: \"0x...\",\n  value: parseEther(\"0.1\"),\n});\nconst receipt = await publicClient.waitForTransactionReceipt({ hash });\n\n\u002F\u002F Write to contract\nconst hash = await walletClient.writeContract({\n  address: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n  abi: erc20Abi,\n  functionName: \"transfer\",\n  args: [\"0xrecipient...\", 1000000n],     \u002F\u002F 1 USDC (6 decimals)\n});\n```\n\n### Event Watching\n\n```typescript\n\u002F\u002F Watch for ERC-20 Transfer events in real-time\nconst unwatch = publicClient.watchContractEvent({\n  address: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n  abi: erc20Abi,\n  eventName: \"Transfer\",\n  onLogs: (logs) => {\n    for (const log of logs) {\n      console.log(`Transfer: ${log.args.from} → ${log.args.to}: ${log.args.value}`);\n    }\n  },\n});\n\n\u002F\u002F Get historical events\nconst transferLogs = await publicClient.getContractEvents({\n  address: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\",\n  abi: erc20Abi,\n  eventName: \"Transfer\",\n  fromBlock: 18000000n,\n  toBlock: 18001000n,\n});\n```\n\n### ENS Resolution\n\n```typescript\n\u002F\u002F ENS name → address\nconst address = await publicClient.getEnsAddress({ name: \"vitalik.eth\" });\n\n\u002F\u002F Address → ENS name\nconst name = await publicClient.getEnsName({\n  address: \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n});\n```\n\n## Installation\n\n```bash\nnpm install viem\n```\n\n## Best Practices\n\n1. **ABI as const** — Declare ABIs with `as const` for full type inference on function names, args, and return types\n2. **Separate clients** — Use `publicClient` for reads (free), `walletClient` for writes (costs gas)\n3. **waitForTransactionReceipt** — Always wait for receipt after sending; don't assume success from hash alone\n4. **parseEther\u002FformatEther** — Use viem's utilities for ETH conversions; never do manual decimal math with bigint\n5. **Chain configuration** — Import chains from `viem\u002Fchains`; includes RPC URLs, block explorer, native currency\n6. **Error handling** — Viem throws typed errors; catch `ContractFunctionRevertedError` for contract reverts\n7. **Batch requests** — Use `multicall` to batch multiple contract reads into one RPC call; reduces latency\n8. **Works with wagmi** — Viem is the core of wagmi (React hooks for Ethereum); same patterns, same types\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fviem",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill viem",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill viem",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill viem","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fviem\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"DESIGN.md","REFERENCE","参考文档",1563,"https:\u002F\u002Fgithub.com\u002FTorchiaHub\u002FSkills\u002Fblob\u002Fmaster\u002F01-Inbox\u002Fdownloads\u002Fbergside-design-skills\u002F20260516T145411Z\u002Fsource\u002Fskills\u002Fgradient\u002FDESIGN.md",[52,66,76,85,91,98],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":62,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[57],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[63,64,65],"model","model hierarchy","model hierarchy skill",{"skillNo":67,"name":68,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":72,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[71],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},[73,74,75],"MCP","zoom","zoom mcp",{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[82,83,84,74],"sdk","zoom apps sdk","apps",{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[87],{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":97,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[96],{"categoryNo":58,"categoryName":59,"taxonomyType":60,"taxonomyTypeDesc":61},[93],{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[100]]