New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cosmjs/cosmwasm-stargate

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cosmjs/cosmwasm-stargate

CosmWasm SDK

  • 0.33.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2K
decreased by-98.67%
Maintainers
2
Weekly downloads
 
Created

What is @cosmjs/cosmwasm-stargate?

@cosmjs/cosmwasm-stargate is a JavaScript library that provides tools for interacting with CosmWasm smart contracts on the Cosmos blockchain. It allows developers to connect to a blockchain, query smart contracts, execute transactions, and manage accounts.

What are @cosmjs/cosmwasm-stargate's main functionalities?

Connect to a Blockchain

This feature allows you to connect to a Cosmos blockchain using a specified RPC endpoint. The code sample demonstrates how to create a StargateClient instance to interact with the blockchain.

const { StargateClient } = require('@cosmjs/stargate');
const rpcEndpoint = "https://rpc.cosmos.network";
const client = await StargateClient.connect(rpcEndpoint);

Query Smart Contracts

This feature allows you to query a smart contract for data. The code sample shows how to use the CosmWasmClient to query a contract for a specific piece of information.

const { CosmWasmClient } = require('@cosmjs/cosmwasm-stargate');
const client = await CosmWasmClient.connect(rpcEndpoint);
const contractAddress = "cosmos1...";
const queryResult = await client.queryContractSmart(contractAddress, { get_count: {} });

Execute Transactions

This feature allows you to execute transactions on a smart contract. The code sample demonstrates how to use a SigningCosmWasmClient to send a transaction that calls a contract's method.

const { SigningCosmWasmClient } = require('@cosmjs/cosmwasm-stargate');
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const client = await SigningCosmWasmClient.connectWithSigner(rpcEndpoint, wallet);
const result = await client.execute(senderAddress, contractAddress, { increment: {} }, fee);

Manage Accounts

This feature allows you to manage accounts, including creating wallets and retrieving account information. The code sample shows how to create a wallet from a mnemonic and get account details.

const { DirectSecp256k1HdWallet } = require('@cosmjs/proto-signing');
const mnemonic = "...";
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic);
const [firstAccount] = await wallet.getAccounts();

Other packages similar to @cosmjs/cosmwasm-stargate

FAQs

Package last updated on 15 Jan 2025

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc