Skip to main content

CosmJS for web and TypeScript

CosmJS is the standard TypeScript SDK for Cosmos chains. Use it for web dashboards, Node scripts, and React Native (see React Native).

Prerequisites

  • Node.js 20+
  • Funded testnet account: faucet
npm i @cosmjs/stargate @cosmjs/proto-signing @cosmjs/encoding

Constants

export const RPC = 'https://rpc.testnet.safrochain.com:443';
export const REST = 'https://rest.testnet.safrochain.com';
export const CHAIN_ID = 'safro-testnet-1';
export const DENOM = 'usaf';

Wallet prefix: addr_safro.

TaskPage
Read-only queriesQuery the chain
Sign and broadcastSigning overview
Browser walletsCosmos Kit
First tx walkthroughFirst transaction
Production

Use Cosmos Kit or another wallet signer in browser apps. Mnemonics in process.env are for scripts and local dev only.