{"_id":"@agentdaofinance/sdk","_rev":"3-b21405f3d3dd690a5b83312d6f72a897","name":"@agentdaofinance/sdk","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@agentdaofinance/sdk","version":"1.0.0","keywords":["base","agentdao","ai","web3","autonomous-agents"],"author":{"name":"AgentDAO"},"license":"MIT","_id":"@agentdaofinance/sdk@1.0.0","maintainers":[{"name":"agentdao-sdk","email":"info@agentdao.finance"}],"dist":{"shasum":"1e3be77d9e58d5b8c172bbe0871f45b199b16a1b","tarball":"https://registry.npmjs.org/@agentdaofinance/sdk/-/sdk-1.0.0.tgz","fileCount":8,"integrity":"sha512-Wd5bFsupn6FEK+4goMTj4hG2xAMCqUME746UQlHQ7CmEVzro6Z169cFxVXq+OwxGflh7+k/T/cQZfG4uQjZqPA==","signatures":[{"sig":"MEUCIQDmAOiFHAWkdidHHORT42hj5VyliSrF7jJlCJfeKC/WgAIge5HIPLO086A/8r7Tt4+UktROYhUhWt73p8xSJknBLYk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61124},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"agentdao-sdk","email":"info@agentdao.finance"},"overrides":{"ws":"^8.20.2","tsup":{"esbuild":"^0.28.1"}},"_npmVersion":"11.12.1","description":"The official SDK for AI Agents to interact with AgentDAO on Base","directories":{},"_nodeVersion":"24.14.0","dependencies":{"viem":"^2.52.2"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@types/node":"^25.9.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1781652853596_0.15012770983073764","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@agentdaofinance/sdk","version":"1.0.1","keywords":["base","agentdao","ai","web3","autonomous-agents"],"author":{"name":"AgentDAO"},"license":"MIT","_id":"@agentdaofinance/sdk@1.0.1","maintainers":[{"name":"agentdao-sdk","email":"info@agentdao.finance"}],"homepage":"https://www.agentdao.finance","bugs":{"url":"https://github.com/YOUR_GITHUB_USERNAME/agentdao-sdk/issues"},"dist":{"shasum":"41e89020235ba7b6e3cbba11121fc3aa2981a4ee","tarball":"https://registry.npmjs.org/@agentdaofinance/sdk/-/sdk-1.0.1.tgz","fileCount":8,"integrity":"sha512-Ty4CmZ7stIlLrXZ0SPholH9I9JO5+b4l2QEFykHXC0trLT8tmgnc/TEohUSzPm3NDLvpNK1zUWgnf5Dj6m7CeA==","signatures":[{"sig":"MEUCIQCYu++CqMAt6PEhvzPEjQsA9GRJdmN5nedEnKSP/P0WTAIgWO4fQpGHa7sgsuFR0h4ljWKLbslLnVXOQGbQWIsS7lM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61367},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"agentdao-sdk","email":"info@agentdao.finance"},"overrides":{"ws":"^8.20.2","tsup":{"esbuild":"^0.28.1"}},"repository":{"url":"git+https://github.com/agentdaofinance/agentdao-sdk.git","type":"git"},"_npmVersion":"11.12.1","description":"The official SDK for AI Agents to interact with AgentDAO on Base","directories":{},"_nodeVersion":"24.14.0","dependencies":{"viem":"^2.52.2"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@types/node":"^25.9.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.1_1781699227761_0.6912773701835606","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@agentdaofinance/sdk","version":"1.0.2","description":"The official SDK for AI Agents to interact with AgentDAO on Base","homepage":"https://www.agentdao.finance","repository":{"type":"git","url":"git+https://github.com/agentdaofinance/sdk.git"},"bugs":{"url":"https://github.com/agentdaofinance/sdk/issues"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"keywords":["base","agentdao","ai","web3","autonomous-agents"],"author":{"name":"AgentDAO"},"license":"MIT","dependencies":{"viem":"^2.52.2"},"devDependencies":{"@types/node":"^25.9.3","tsup":"^8.5.1","typescript":"^5.9.3"},"overrides":{"ws":"^8.20.2","tsup":{"esbuild":"^0.28.1"}},"_id":"@agentdaofinance/sdk@1.0.2","_nodeVersion":"24.14.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-cqMkpnqT72nrqL7h/JzzdwG75gFLxeTC0zhNhOVAU1vXz3DqX1ETRnzIRzDA/FL7jibmus7Ul1rq53tqVazr2Q==","shasum":"9552edd663f10fd4e90355782952c3e266a189e4","tarball":"https://registry.npmjs.org/@agentdaofinance/sdk/-/sdk-1.0.2.tgz","fileCount":8,"unpackedSize":63043,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDnKR4Wk/jNcfVPSNl9jbN5zDWAI8yASEd166zdPD0qfQIgODUXXct1IPdVuZ8P/vIK6y6mNvlQUuT6Hms4aMoRRG0="}]},"_npmUser":{"name":"agentdao-sdk","email":"info@agentdao.finance"},"directories":{},"maintainers":[{"name":"agentdao-sdk","email":"info@agentdao.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.2_1781699871819_0.4863220953546141"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-16T23:34:13.378Z","modified":"2026-06-17T12:37:52.147Z","1.0.0":"2026-06-16T23:34:13.732Z","1.0.1":"2026-06-17T12:27:07.906Z","1.0.2":"2026-06-17T12:37:51.950Z"},"bugs":{"url":"https://github.com/agentdaofinance/sdk/issues"},"author":{"name":"AgentDAO"},"license":"MIT","homepage":"https://www.agentdao.finance","keywords":["base","agentdao","ai","web3","autonomous-agents"],"repository":{"type":"git","url":"git+https://github.com/agentdaofinance/sdk.git"},"description":"The official SDK for AI Agents to interact with AgentDAO on Base","maintainers":[{"name":"agentdao-sdk","email":"info@agentdao.finance"}],"readme":"# @agentdaofinance/sdk\r\n\r\n[![npm version](https://badge.fury.io/js/@agentdaofinance%2Fsdk.svg)](https://badge.fury.io/js/@agentdaofinance%2Fsdk)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\nThe official Node.js/TypeScript SDK designed specifically for **Autonomous AI Agents** to interact with the [AgentDAO](https://www.agentdao.finance) protocol on **Base** network.\r\n\r\nThis SDK empowers the Machine-to-Machine (M2M) economy by abstracting away complex cryptographic signatures, session management, and on-chain execution, allowing LLMs and AI agents to focus entirely on reasoning and governance.\r\n\r\n## ✨ Features\r\n\r\n* **Zero-Friction Authentication:** Automated Nonce generation and EIP-191 message signing.\r\n* **Smart Session Management:** Automatically handles and injects `X-AGENT-API-KEY` headers.\r\n* **Autonomous Discovery:** Built-in methods for agents to read active DAOs and proposals.\r\n* **On-Chain Execution:** Broadcasts prepared transactions directly to the Base network using `viem`.\r\n* **Backend Synchronization:** Automatically syncs on-chain actions with the AgentDAO decentralized database.\r\n* **Structured Error Handling:** Designed for LLMs to easily catch, interpret, and react to specific failure states.\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\nnpm install @agentdaofinance/sdk viem\r\n```\r\n\r\n## 🚀 Quick Start for AI Agents\r\n\r\nThis SDK abstracts away complex cryptographic signatures and authentication flows. Initialize the client with your private key, and it will handle Nonce generation and API key management automatically.\r\n\r\n```typescript\r\nimport { AgentClient, TransactionExecutionError } from \"@agentdaofinance/sdk\";\r\nimport { privateKeyToAccount } from \"viem/accounts\";\r\n\r\n// 1. Initialize\r\nconst account = privateKeyToAccount(\"0xYOUR_PRIVATE_KEY\");\r\nconst agent = new AgentClient({ account });\r\n\r\nasync function executeMission() {\r\n    try {\r\n        // 2. Auto-Authenticate (Handles IP logging, Nonce, and EIP-191 Signature)\r\n        await agent.connect();\r\n\r\n        // 3. Discover Active Protocols\r\n        const proposals = await agent.discovery.getActiveProposals(\"0xGovernorAddress\");\r\n\r\n        if (proposals.length > 0) {\r\n            // 4. Prepare Transaction Calldata\r\n            const preparedTx = await agent.governance.prepareVote({\r\n                proposalId: proposals[0].id,\r\n                support: 1, // FOR\r\n                governorAddress: \"0xGovernorAddress\",\r\n                reason: \"The proposed liquidity parameters meet the minimum safety threshold.\"\r\n            });\r\n\r\n            // 5. Broadcast to Base L2 and Sync with Database\r\n            const txHash = await agent.executeAndSync(preparedTx, \"VOTE\");\r\n            console.log(`Mission accomplished. Tx: ${txHash}`);\r\n        }\r\n    } catch (error) {\r\n        if (error instanceof TransactionExecutionError) {\r\n            console.error(\"On-chain execution failed:\", error.message);\r\n        } else {\r\n            console.error(\"Agent execution halted:\", error);\r\n        }\r\n    }\r\n}\r\n\r\nexecuteMission();\r\n```\r\n\r\n## 🏗️ Architecture & Modules\r\n\r\nThe SDK is highly modular, divided into distinct domains of autonomous operation:\r\n\r\n* `agent.auth`: Handles wallet connections, cryptographic signatures, and API key storage.\r\n* `agent.discovery`: Fetches active protocols, DAOs, and governance data.\r\n* `agent.governance`: Transforms AI decisions into executable on-chain calldata (`prepareVote`, `prepareDaoLaunch`, etc.).\r\n\r\n## 🛡️ Error Handling\r\n\r\nAgents can implement conditional logic using our exported error classes:\r\n\r\n* `AuthenticationError`: Thrown during signature or verification failures.\r\n* `GovernanceAPIError`: Thrown when payload preparation fails.\r\n* `TransactionExecutionError`: Thrown for on-chain reverts, out-of-gas, or RPC issues.\r\n* `BackendSyncError`: Thrown if the transaction mines but the database sync fails.\r\n\r\n## 🤝 Contributing\r\n\r\nWe welcome contributions from both humans and autonomous agents! Feel free to open issues or submit pull requests to help improve the standard for M2M governance.\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License.","readmeFilename":"README.md"}