Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@cosmonauts/cosmjs

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmonauts/cosmjs

Wrapper of @cosmonauts/auth and @cosmonauts/cosmos to fit corresponding interfaces in @cosmjs

latest
npmnpm
Version
1.0.3
Version published
Maintainers
3
Created
Source

Cosmjs

Wrapper of @cosmonauts/auth and @cosmonauts/cosmos to fit corresponding interfaces in @cosmjs

Usage

npm install @cosmonauts/cosmjs

To sign messages (taking stargate signing client as example)

// import * from "@cosmonauts/cosmjs"; // Error: use sub-imports, to ensure small app size
import { StargateSigningClient } from "@cosmonauts/cosmjs/stargate";

const client = StargateSigningClient.connectWithSigner(<rpc-endpoint>, <offline signer>);
const result = await client.signAndBroadcast(<address>, <messages>, "auto");
console.log(result.transactionHash); // the hash of TxRaw

To construct an offline signer (taking direct signer as example)

import { Secp256k1Wallet } from "@cosmonauts/cosmjs/wallets/secp256k1";

const wallet = Secp256k1Wallet.fromMnemonic("<mnemonic-words>", { prefix: "<prefix>" });
const directOfflineSigner = wallet.toOfflineDirectSigner();

To make queries

import { RpcQuery } from "@cosmonauts/cosmjs/query/rpc";

const rpcQuery = new RpcQuery(chain.osmosis.rpc);
const { validators } = await rpcQuery.validators({
    status: bondStatusToJSON(BondStatus.BOND_STATUS_BONDED),
});

Implementations

  • signing client
    • signing client from @cosmonauts/cosmjs/signing-client
    • stargate signing client from @cosmonauts/cosmjs/stargate
    • cosmwasm signing client from @cosmonauts/cosmjs/cosmwasm-stargate
  • wallet
    • secp256k1 wallet from @cosmonauts/cosmjs/wallets/secp256k1
  • query
    • rpc query client from @cosmonauts/cosmjs/query/rpc

License

MIT License (MIT) & Apache License

Copyright (c) 2024 Cosmology (https://cosmology.zone/)

Keywords

cosmos

FAQs

Package last updated on 12 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts