Cosmology
raw JSON → 3.0.2 verified Fri May 01 auth: no javascript
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.
Common errors
error Error: Cannot find module '@cosmology/core' ↓
cause @cosmology/core is not installed as a dependency
fix
npm install @cosmology/core
error TypeError: CosmologyClient is not a constructor ↓
cause Importing from wrong package (cosmology instead of @cosmology/core)
fix
import { CosmologyClient } from '@cosmology/core'
error Command not found: cosmology ↓
cause CLI not installed globally
fix
npm install -g cosmology
Warnings
breaking cosmology v3 removed support for Node.js <16 ↓
fix Upgrade Node.js to 16 or later.
deprecated The @cosmology/cli package is now deprecated; use 'cosmology' directly ↓
fix npm uninstall -g @cosmology/cli && npm install -g cosmology
gotcha Default import from 'cosmology' does not exist; the package only exports a CLI bin ↓
fix Use the @cosmology/core library for programmatic access.
Install
npm install cosmology yarn add cosmology pnpm add cosmology Imports
- CosmologyClient wrong
import { CosmologyClient } from 'cosmology'correctimport { CosmologyClient } from '@cosmology/core' - default import of Cosmology wrong
const Cosmology = require('cosmology')correctimport Cosmology from '@cosmology/core' - types wrong
import { CosmosConfig } from '@cosmology/core'correctimport type { CosmosConfig } from '@cosmology/core'
Quickstart
// Install CLI globally: npm install -g cosmology
// Then run:
cosmology trade --amount 100 --from mywallet --to cosmos1...
// Or use library:
import { CosmologyClient } from '@cosmology/core';
const client = new CosmologyClient({ rpcUrl: 'https://rpc.cosmos.network' });
const balances = await client.getBalances('cosmos1...');
console.log(balances);