{"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,"search_vec":"'0.0.18':23,54 'client':14 'code':31 'contract':8 'cosmos':46 'cosmscript':1 'cosmwasm':6 'current':19 'differenti':28 'earli':53 'ecosystem':47 'end':37,39 'end-to-end':36 'focus':34 'generat':10,32 'integr':43 'irregular':25 'javascript':62 'librari':15 'limit':60 'may':58 'note':48 'packag':57 'protobuf':17 'releas':26 'safe':13 'schema':18 'smart':7 'stabil':61 'stabl':20 'support':41 'transpil':4 'type':12 'type-saf':11 'typescript':3,40,63 'version':21,50","created_at":"2026-05-01T13:43:10.294184+00:00","updated_at":"2026-05-01T13:43:10.294184+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"cosmscript","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pyramation/cosmscript.git#master","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/cosmscript","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}