Go to file
2025-02-11 16:10:26 +00:00
.circleci Go back to ubuntu-2004:202111-02 2025-01-15 12:24:31 +01:00
.github/workflows Ignore autogenerated PNP files in CodeQL 2023-06-26 13:32:56 +02:00
.yarn Upgrade protobufjs to 7.4 2025-01-15 13:38:19 +01:00
docs add doc folders and empty files 2022-04-27 17:19:50 +02:00
packages Set version 0.33.0 2025-01-15 13:58:25 +01:00
scripts Try v0.51.0-rc.5 2024-04-22 09:31:50 +02:00
.editorconfig Set up format and lint configs 2020-01-22 22:24:22 +01:00
.eslintignore eslint: Update .eslintignore 2020-07-15 13:22:32 +02:00
.eslintrc.js Adjust eslint config to make it work again 2023-03-01 15:32:06 +01:00
.gitattributes Add .zip files to LFS 2021-05-18 15:16:03 +02:00
.gitignore adding show address in ledgerSigner 2022-01-26 13:44:53 +01:00
.mergify.yml Rename branch master -> main 2021-01-19 23:37:10 +01:00
.nycrc.yml Standardize .nycrc.yml 2020-10-13 12:31:16 +02:00
.pnp.cjs Upgrade protobufjs to 7.4 2025-01-15 13:38:19 +01:00
.pnp.loader.mjs Upgrade yarn to 4.6.0 2025-01-14 18:21:09 +01:00
.prettierrc.json Move prettier config for markdown to config 2021-04-28 16:54:44 +02:00
.yarnrc.yml Uncompress all the dependencies 2025-01-15 12:03:52 +01:00
CHANGELOG.md Set version 0.33.0 2025-01-15 13:58:25 +01:00
codecov.yml Disable bot comments for PRs 2020-06-25 13:32:26 +02:00
HACKING.md Add Tendermint 0.37 RPC port 2023-04-06 17:20:35 +02:00
jasmine-spec-reporter.config.json Upgrade dev packages (#256) 2020-06-28 10:20:15 +02:00
LICENSE Use an unmodified copy of Apache-2.0 2020-01-23 18:32:43 +01:00
NOTICE Re-implement bip39 2022-02-27 13:12:14 +01:00
package.json Set new --all flag to "yarn workspaces foreach" 2025-01-14 18:23:20 +01:00
README.md chore: update discord link 2025-02-11 16:10:26 +00:00
tsconfig.json Target es2020 2022-12-07 21:04:04 +01:00
yarn.lock Upgrade protobufjs to 7.4 2025-01-15 13:38:19 +01:00

CosmJS

CosmJS is the Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers in the Cosmos ecosystem.

"Cosm" is short for Cosmos and "JS" is short for runs everywhere we actually develop in TypeScript.

Documentation

Here is a list of examples using the Stargate package for use with Cosmos SDK 0.41 applications (like gaia 4). Take a look at the wiki page, "What can CosmJS do for me?" and various tests (ex) for more example usage of the packages.

API documentation

The full API documentation is hosted at cosmos.github.io/cosmjs. This is a bit tricky to navigate and requires basic TypeScript understanding. It is helpful if you want to look up details for advanced use cases. This documentation is auto-generated based on the current main branch and can occasionally diverge from the latest release.

Using custom Stargate modules

Documentation on how to use your own custom modules with CosmJS for Stargate chains (Cosmos SDK v0.41) can be found here.

Packages

CosmJS is a library that consists of many smaller npm packages within the @cosmjs namespace, a so-called monorepo. Here are some of them to get an idea:

Package Description Latest
@cosmjs/stargate A client library for the Cosmos SDK 0.40+ (Stargate) npm version
@cosmjs/faucet A faucet application for node.js npm version
@cosmjs/cosmwasm-stargate Client for Stargate chains with the CosmWasm module enabled npm version
@cosmjs/crypto Cryptography for blockchain projects, e.g. hashing (SHA-2, Keccak256, Ripemd160), signing (secp256k1, ed25519), HD key derivation (BIP-39, SLIP-0010), KDFs and symmetric encryption for key storage (PBKDF2, Argon2, XChaCha20Poly1305) npm version
@cosmjs/encoding Encoding helpers for blockchain projects npm version
@cosmjs/math Safe integers; decimals for handling financial amounts npm version

Modularity

We're pretty proud of the modularity and a clean dependency tree in this monorepo. This ensures software quality on our side and lets users pick exactly what they need. Here you see how everything fits together (every item is a npm package; right depends on left):

CosmJS dependency tree

If this was not enough to scare you away, check out the version including app runtime dependencies: cosmjs-tree-full.png.

Supported JS environments

Currently the codebase supports the following runtime environments:

  1. Node.js 14+
  2. Modern browsers (Chromium/Firefox/Safari, no Internet Explorer or Edge Spartan)
  3. Browser extensions (Chromium/Firefox)

Our current JavaScript target standard is ES2020. We use WebAssembly to implement certain cryptographic functions.

We're happy to adjust this list according to users' needs as long as you don't ask for Internet Explorer support. If your environment does not support Wasm, we can work on a solution with swappable implementations.

Webpack Configs

With WebPack 5, you have to be explicit about the usage of Node.js types and modules that were simply replaced with re-implementations for browsers in Webpack 4.

Configs for 0.28 and later:

module.exports = [
  {
    // ...
    plugins: [
      ...,
      new webpack.ProvidePlugin({
        Buffer: ["buffer", "Buffer"],
      }),
    ],
    // ...
    resolve: {
      fallback: {
        buffer: false,
        crypto: false,
        events: false,
        path: false,
        stream: false,
        string_decoder: false,
      },
    },
  },
];

Configs for CosmJS < 0.28

module.exports = [
  {
    // ...
    plugins: [
      ...,
      new webpack.ProvidePlugin({
        Buffer: ["buffer", "Buffer"],
      }),
    ],
    // ...
    resolve: {
      fallback: {
        buffer: false,
        crypto: false,
        events: false,
        path: false,
        stream: require.resolve("stream-browserify"),
        string_decoder: false,
      },
    },
  },
];

Roadmap

We maintain a development board, use release milestones and share important updates in the CosmWasm Community Call. For higher level roadmap discussion please reach out to the team.

Known limitations

0.26

  1. When connecting to a Cosmos SDK 0.44+ backend, the verified queries from AuthExtension and BankExtension as well as StargateClient.getAccountVerified will fail because the storage keys are not stable. Unverified queries can be used instead. Those queries are deprecated now and will be removed in 0.27 (#910).

0.25

  1. Decoding blocks of height 1 is unsupported. This is fixed in #815 and will be released as part of CosmJS 0.26.

0.24

  1. AuthExtension and all higher level Stargate clients only support BaseAccounts for all functionality, including getting account numbers and sequences for transaction signing. This will be implemented for all common Cosmos SDK account types in the 0.25 series.

Get in touch

The CosmJS development team is happy to get in touch with you for all questions and suggestions.

Development

See HACKING.md.