InterchainJS (Beta ⚡️)
Overview

InterchainJS

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network.

Table of Contents

InterchainJS: Universal Signing for Web3

InterchainJS (opens in a new tab) is a universal signing interface designed for seamless interoperability across blockchain networks. It is one of the core libraries of the Interchain JavaScript Stack (opens in a new tab), a modular framework that brings Web3 development to millions of JavaScript developers.

At its core, InterchainJS provides a flexible adapter pattern that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework.

Overview

InterchainJS sits at the foundation of the Interchain JavaScript Stack (opens in a new tab), a set of tools that work together like nested building blocks:

This modular architecture ensures compatibility, extensibility, and ease of use, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge.

Visualizing InterchainJS Components

The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments.

Installation

This guide will walk you through the process of installing and setting up interchainjs for your project.

You can install interchainjs using Yarn:

yarn add interchainjs
yarn add @interchainjs/cosmos

or npm

npm i interchainjs
npm i @interchainjs/cosmos

Quick Start

Get a signing client to send the trasactions:

import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos";
 
const signingClient = await CosmosSigningClient.connectWithSigner(
  await getRpcEndpoint(),
  new DirectGenericOfflineSigner(directSigner),
  {
    registry: [
      // as many as possible encoders registered here.
      MsgDelegate,
      MsgSend,
    ],
    broadcast: {
      checkTx: true,
    },
  }
);
 
// sign and broadcast
const result = await signingClient.signAndBroadcast(<MESSAGE>[]);
console.log(result.hash); // the hash of TxRaw

Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions:

import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client";
import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func";
import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func";
 
// query to get balance
const { balance } = await getBalance(await getRpcEndpoint(), {
  address: directAddress,
  denom,
});
 
const signingClient = await CosmosSigningClient.connectWithSigner(
  await getRpcEndpoint(),
  new DirectGenericOfflineSigner(directSigner),
  {
    // no registry needed here anymore
    // registry: [
    // ],
    broadcast: {
      checkTx: true,
    },
  }
);
 
// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once.
const result = await submitProposal(
  signingClient,
  directAddress,
  {
    proposer: directAddress,
    initialDeposit: [
      {
        amount: "1000000",
        denom: denom,
      },
    ],
    content: {
      typeUrl: "/cosmos.gov.v1beta1.TextProposal",
      value: TextProposal.encode(contentMsg).finish(),
    },
  },
  fee,
  "submit proposal"
);
console.log(result.hash); // the hash of TxRaw

Quick Setup with create-interchain-app

The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies:

npm install -g create-interchain-app
 
cia --example authz

Then an authz example website will be created and users can take a look how signing clients and helper functions are used.


Supported Networks

Cosmos Network

FeaturePackage
Transactions@interchainjs/cosmos (opens in a new tab)
Cosmos Types@interchainjs/cosmos-types (opens in a new tab)
Migration from @cosmjsMigration Guide (opens in a new tab)

Injective Network

FeaturePackage
Transactions@interchainjs/injective (opens in a new tab)

Ethereum Network

FeaturePackage
Transactions@interchainjs/ethereum (opens in a new tab)

Interchain JavaScript Stack ⚛️

A unified toolkit for building applications and smart contracts in the Interchain ecosystem

CategoryToolsDescription
Chain InformationChain Registry (opens in a new tab), Utils (opens in a new tab), Client (opens in a new tab)Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application.
Wallet ConnectorsInterchain Kit (opens in a new tab)beta, Cosmos Kit (opens in a new tab)Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface.
Signing ClientsInterchainJS (opens in a new tab)beta, CosmJS (opens in a new tab)A single, universal signing interface for any network
SDK ClientsTelescope (opens in a new tab)Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules.
Starter KitsCreate Interchain App (opens in a new tab)beta, Create Cosmos App (opens in a new tab)Set up a modern Interchain app by running one command.
UI KitsInterchain UI (opens in a new tab)The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit.
Testing FrameworksStarship (opens in a new tab)Unified Testing and Development for the Interchain.
TypeScript Smart ContractsCreate Hyperweb App (opens in a new tab)Build and deploy full-stack blockchain applications with TypeScript
CosmWasm ContractsCosmWasm TS Codegen (opens in a new tab)Convert your CosmWasm smart contracts into dev-friendly TypeScript classes.

Credits

🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to our github ⚛️ (opens in a new tab)

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.