{"id":25128,"library":"cosmscript","title":"cosmscript","description":"A TypeScript transpiler for CosmWasm smart contracts that generates type-safe client libraries from Protobuf schemas. Current stable version is 0.0.18, with irregular releases. It differentiates from other code generators by focusing on end-to-end TypeScript support and integration with the Cosmos ecosystem. Note: The version is very early (0.0.18) and the package may have limited stability.","status":"active","version":"0.0.18","language":"javascript","source_language":"en","source_url":"https://github.com/pyramation/cosmscript#master","tags":["javascript","typescript"],"install":[{"cmd":"npm install cosmscript","lang":"bash","label":"npm"},{"cmd":"yarn add cosmscript","lang":"bash","label":"yarn"},{"cmd":"pnpm add cosmscript","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require will fail.","wrong":"const cosmscript = require('cosmscript')","symbol":"cosmscript","correct":"import { cosmscript } from 'cosmscript'"},{"note":"CosmWasmClient is not part of cosmscript; it comes from @cosmjs/cosmwasm-stargate.","wrong":"import { CosmWasmClient } from 'cosmscript'","symbol":"CosmWasmClient","correct":"import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate'"},{"note":"generate is a named export, not default.","wrong":"import generate from 'cosmscript'","symbol":"generate","correct":"import { generate } from 'cosmscript'"}],"quickstart":{"code":"// Install cosmscript globally\n// npm install -g cosmscript\n\n// Generate TypeScript types from schema\n// cosmscript generate \\\n//   --schema ./schema \\\n//   --out ./src \\\n//   --name MyContract\n\n// Example using generated code:\nimport { CosmWasmClient } from '@cosmjs/cosmwasm-stargate';\nimport { MyContractQueryClient } from './src/MyContract.client';\n\nconst client = await CosmWasmClient.connect('https://rpc.cosmos.network');\nconst queryClient = new MyContractQueryClient(client, 'cosmos1...');\nconst config = await queryClient.config();\nconsole.log(config);","lang":"typescript","description":"Install cosmscript globally, generate client code from a CosmWasm schema, then use the generated client to query a contract."},"warnings":[{"fix":"Pin to exact version and test upgrades carefully.","message":"cosmscript version 0.0.18 is very early; API may break without notice.","severity":"gotcha","affected_versions":"<=0.0.18"},{"fix":"Use import syntax and ensure your project is configured for ESM (e.g., type: 'module' in package.json).","message":"Package is ESM-only; does not support CommonJS require.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Run npm install @cosmjs/cosmwasm-stargate @cosmjs/proto-signing in your project.","message":"Generated code depends on @cosmjs/cosmwasm-stargate and @cosmjs/proto-signing; these must be installed separately.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to import statement or use dynamic import().","cause":"Using CommonJS require on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/cosmscript/index.js from /path/to/your/file.js not supported."},{"fix":"Install @cosmjs/cosmwasm-stargate via npm.","cause":"Missing required peer dependency.","error":"Cannot find module '@cosmjs/cosmwasm-stargate'"},{"fix":"Use import { generate } from 'cosmscript'.","cause":"Using default import instead of named import for generate.","error":"TypeError: cosmscript.generate is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}