{"_id":"@0xsequence/sidekick-cli","name":"@0xsequence/sidekick-cli","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@0xsequence/sidekick-cli","version":"0.0.1","description":"Sidekick API CLI","private":false,"main":"dist/index.js","bin":{"sidekick-cli":"dist/index.js"},"keywords":["sidekick","Sequence","api","smart-contract","ethereum","web3","fastify","typescript"],"license":"MIT","type":"commonjs","engines":{"node":">=16.0.0"},"dependencies":{"commander":"^11.0.0","fs-extra":"^11.1.1"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/node":"^20.0.0","typescript":"^5.0.0"},"scripts":{"build":"tsc","dev":"tsc --watch","start":"node dist/index.js","release":"pnpm build && pnpm publish --access public --no-git-checks"},"_id":"@0xsequence/sidekick-cli@0.0.1","types":"./dist/index.d.ts","_integrity":"sha512-b9Jzw42f7k1ffqZO8OYTYrBbfbpA53QZw6M1jtjgSU2EhyI32cjsOFRgZFty+GoJC5jhNSljktT+ibGFzhDPGw==","_resolved":"/private/var/folders/g6/0nm7fcp56d12by2dwrqvsvww0000gn/T/a6151ae694f349f0acd1dae62c903788/0xsequence-sidekick-cli-0.0.1.tgz","_from":"file:0xsequence-sidekick-cli-0.0.1.tgz","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-b9Jzw42f7k1ffqZO8OYTYrBbfbpA53QZw6M1jtjgSU2EhyI32cjsOFRgZFty+GoJC5jhNSljktT+ibGFzhDPGw==","shasum":"f9c0cce4362041c390ee1d9b8f0e9383ce7aff1a","tarball":"https://registry.npmjs.org/@0xsequence/sidekick-cli/-/sidekick-cli-0.0.1.tgz","fileCount":10,"unpackedSize":47224,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHkyEf5o1CJuw1aU9rZ0a6zPLmtezyfrMjY37rSlOejuAiEA+igEW1Y10D2TlgNgyIlg98o7iAIANptw4eito4+Im7g="}]},"_npmUser":{"name":"taylanpince","email":"taylan@hipolabs.com"},"directories":{},"maintainers":[{"name":"naivesheep","email":"wh@horizongames.net"},{"name":"pkieltyka","email":"pk@horizon.io"},{"name":"agusx1211","email":"agusxrun@gmail.com"},{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"milkytaste","email":"screaminghawk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sidekick-cli_0.0.1_1759904912393_0.8591008142882257"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-08T06:28:32.002Z","0.0.1":"2025-10-08T06:28:32.595Z","modified":"2025-10-08T06:28:33.014Z"},"maintainers":[{"name":"naivesheep","email":"wh@horizongames.net"},{"name":"pkieltyka","email":"pk@horizon.io"},{"name":"agusx1211","email":"agusxrun@gmail.com"},{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"milkytaste","email":"screaminghawk@gmail.com"}],"description":"Sidekick API CLI","keywords":["sidekick","Sequence","api","smart-contract","ethereum","web3","fastify","typescript"],"license":"MIT","readme":"# Sidekick CLI\n\nA powerful command-line tool for generating Fastify API endpoints from smart contract ABIs for [Sequence Sidekick](https://github.com/0xsequence/sidekick).\n\n## Features\n\n- 🚀 **Automatic API Generation**: Generate complete Fastify API endpoints from any smart contract ABI\n- 📝 **Write Endpoints**: Create transaction endpoints for state-changing functions\n- 📖 **Read Endpoints**: Create query endpoints for view/pure functions\n- 🔄 **Function Overloading Support**: Handle multiple functions with the same name\n- 🎯 **TypeScript Support**: Full TypeScript type definitions and schemas\n- 🔧 **Customizable Output**: Flexible output directory configuration\n- 🛡️ **Error Handling**: Comprehensive error handling and logging\n\n## Installation\n\n### Global Installation (Published Package)\n```bash\nnpm install -g @0xsequence/sidekick-cli\n# or\npnpm install -g @0xsequence/sidekick-cli\n# or\nyarn install -g @0xsequence/sidekick-cli\n```\n\n## Usage Guide\n\n```bash\nsidekick-cli build-api \\\n  --abi ./abis/erc20.json \\\n  --output ./src/contract/extensions\n```\n\nThe CLI will automatically import the generated API routes into `src/routes/index.ts` in order to expose the endpoints to your Fastify app.\n\nIf no output directory is provided, the CLI will default to `./src/routes/contract/autogenerated`.\n\nIf no contract name is provided, the CLI will automatically use the ABI file name.\n\nIf provided, --contract-name must match the ABI file name. (ex: ERC20.json -> ERC20)\n\n### Command Options\n\n| Option | Required | Description | Default |\n|--------|----------|-------------|---------|\n| `--abi <path>` | ✅ | Path to the ABI JSON file | - |\n| `--contract-name <name>` | ✅ | Name of the smart contract | - |\n| `--output <path>` | ❌ | Output directory for generated files | `./generated` |\n\n### Examples\n\n#### Generate API for ERC20 Tokens\n\n```bash\nsidekick-cli build-api \\\n  --abi ./abis/erc20.json \\\n  --contract-name ERC20 \\\n  --output ./api/contracts\n```\n\n#### Generate API for Custom Contracts\n\n```bash\nsidekick-cli build-api \\\n  --abi ./contracts/MyNFT.json \\\n  --contract-name MyNFT \\\n  --output ./generated-apis\n```\n\n## Generated Output Structure\n\nThe CLI generates a well-organized directory structure:\n\n```\n{output-directory}/\n└── {contract-name}/\n    ├── index.ts              # Main registration file\n    ├── read/                 # Read-only function endpoints\n    │   ├── balanceOf.ts\n    │   ├── name.ts\n    │   └── symbol.ts\n    └── write/                # State-changing function endpoints\n        ├── transfer.ts\n        ├── approve.ts\n        └── mint.ts\n```\n\n## Supported ABI Types\n\nThe CLI automatically maps Solidity types to TypeScript types:\n\n| Solidity Type | TypeScript Type | Notes |\n|---------------|-----------------|-------|\n| `uint*` | `string` | Converted to string for JSON compatibility |\n| `int*` | `string` | Converted to string for JSON compatibility |\n| `address` | `string` | Ethereum address as string |\n| `string` | `string` | Direct mapping |\n| `bytes*` | `string` | Hex-encoded bytes |\n| `bool` | `boolean` | Boolean type |\n| `*[]` | `string[]` | Arrays of any supported type |\n \n## Unsupported Parameter Types (WIP)\n\n- Structs (tuple): A function like `function setUser(User memory _user)` where User is a struct will not work.\n- Arrays of Structs (tuple[]): A function like `function addUsers(User[] memory _users)` will not be supported.\n- Multi-dimensional Arrays: A function defined as `function setMatrix(uint256[][] memory _matrix)` would have its parameter type incorrectly handled.\n- Fixed-Size Arrays: A function signature like `function setWhitelist(address[10] memory _addresses)` will not be correctly processed.\n\n## Function Overloading\n\nThe CLI handles function overloading by appending numeric suffixes:\n\n- `transfer(address,uint256)` → `transfer.ts`\n- `transfer(address,uint256,bytes)` → `transfer_2.ts`\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## Support\n\nFor issues and questions, please open an issue on the GitHub repository.\n","readmeFilename":"README.md","_rev":"1-ba68bfc12212139047a375404d9a8615"}