Registry / devops / cosmscript

cosmscript

JSON →
library0.0.18jsnpmunverified

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.

npm install cosmscript
INSTALL
IMPORT
SIG · COSMSCRIPT
C
cosmscript
devopsjavascriptv0.0.18
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cosmscript
✓ import { cosmscript } from 'cosmscript'
✗ const cosmscript = require('cosmscript')
Package is ESM-only; CommonJS require will fail.
CosmWasmClient
✓ import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate'
✗ import { CosmWasmClient } from 'cosmscript'
CosmWasmClient is not part of cosmscript; it comes from @cosmjs/cosmwasm-stargate.
generate
✓ import { generate } from 'cosmscript'
✗ import generate from 'cosmscript'
generate is a named export, not default.

Install cosmscript globally, generate client code from a CosmWasm schema, then use the generated client to query a contract.

// Install cosmscript globally // npm install -g cosmscript // Generate TypeScript types from schema // cosmscript generate \ // --schema ./schema \ // --out ./src \ // --name MyContract // Example using generated code: import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate'; import { MyContractQueryClient } from './src/MyContract.client'; const client = await CosmWasmClient.connect('https://rpc.cosmos.network'); const queryClient = new MyContractQueryClient(client, 'cosmos1...'); const config = await queryClient.config(); console.log(config);
cosmscript --version
Debug
Known issues
gotchacosmscript version 0.0.18 is very early; API may break without notice.
fix
Pin to exact version and test upgrades carefully.
affects: <=0.0.18
breakingPackage is ESM-only; does not support CommonJS require.
fix
Use import syntax and ensure your project is configured for ESM (e.g., type: 'module' in package.json).
affects: >=0.0.1
gotchaGenerated code depends on @cosmjs/cosmwasm-stargate and @cosmjs/proto-signing; these must be installed separately.
fix
Run npm install @cosmjs/cosmwasm-stargate @cosmjs/proto-signing in your project.
affects: >=0.0.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/cosmscript/index.js from /path/to/your/file.js not supported.
Using CommonJS require on an ESM-only package.
fix
Change to import statement or use dynamic import().
Cannot find module '@cosmjs/cosmwasm-stargate'
Missing required peer dependency.
fix
Install @cosmjs/cosmwasm-stargate via npm.
TypeError: cosmscript.generate is not a function
Using default import instead of named import for generate.
fix
Use import { generate } from 'cosmscript'.
Upgrade
Version history
0.0.18latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
cosmscript — npm install cosmscript · libregistry