{"id":25127,"library":"cosmology","title":"Cosmology","description":"Cosmology is a CLI and TypeScript/JavaScript library for building web3 applications on the Osmosis and Cosmos ecosystems. Version 3.0.2 is the latest stable release, with active development and periodic updates. It enables cryptocurrency trades, liquidity pool participation, and staking rewards directly from the command line or programmatically via the @cosmology/core library. Differentiators include tight integration with Cosmos SDK chains and tools like Telescope and osmojs. The package ships TypeScript types for better developer experience.","status":"active","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/cosmology-tech/cosmology","tags":["javascript","typescript"],"install":[{"cmd":"npm install cosmology","lang":"bash","label":"npm"},{"cmd":"yarn add cosmology","lang":"bash","label":"yarn"},{"cmd":"pnpm add cosmology","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core TS/JS library powering the CLI operations","package":"@cosmology/core","optional":false}],"imports":[{"note":"The 'cosmology' package is the CLI wrapper; the library is published separately.","wrong":"import { CosmologyClient } from 'cosmology'","symbol":"CosmologyClient","correct":"import { CosmologyClient } from '@cosmology/core'"},{"note":"ESM-only package; avoid require().","wrong":"const Cosmology = require('cosmology')","symbol":"default import of Cosmology","correct":"import Cosmology from '@cosmology/core'"},{"note":"Use type import to avoid bundling if only using types.","wrong":"import { CosmosConfig } from '@cosmology/core'","symbol":"types","correct":"import type { CosmosConfig } from '@cosmology/core'"}],"quickstart":{"code":"// Install CLI globally: npm install -g cosmology\n// Then run:\ncosmology trade --amount 100 --from mywallet --to cosmos1...\n\n// Or use library:\nimport { CosmologyClient } from '@cosmology/core';\nconst client = new CosmologyClient({ rpcUrl: 'https://rpc.cosmos.network' });\nconst balances = await client.getBalances('cosmos1...');\nconsole.log(balances);","lang":"typescript","description":"Installs the global CLI and demonstrates a trade command, then shows how to instantiate the core client to fetch balances."},"warnings":[{"fix":"Upgrade Node.js to 16 or later.","message":"cosmology v3 removed support for Node.js <16","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"npm uninstall -g @cosmology/cli && npm install -g cosmology","message":"The @cosmology/cli package is now deprecated; use 'cosmology' directly","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use the @cosmology/core library for programmatic access.","message":"Default import from 'cosmology' does not exist; the package only exports a CLI bin","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install @cosmology/core","cause":"@cosmology/core is not installed as a dependency","error":"Error: Cannot find module '@cosmology/core'"},{"fix":"import { CosmologyClient } from '@cosmology/core'","cause":"Importing from wrong package (cosmology instead of @cosmology/core)","error":"TypeError: CosmologyClient is not a constructor"},{"fix":"npm install -g cosmology","cause":"CLI not installed globally","error":"Command not found: cosmology"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}