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

@substrate/connect

Package Overview
Dependencies
Maintainers
15
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@substrate/connect

Substrate-connect to Smoldot clients. Using either substrate extension with predefined clients or an internal smoldot client based on chainSpecs provided.

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
101K
decreased by-1.53%
Maintainers
15
Weekly downloads
 
Created

What is @substrate/connect?

@substrate/connect is a JavaScript library that provides a way to connect to Substrate-based blockchain nodes. It offers a convenient API to interact with the blockchain, manage connections, and handle different types of network environments.

What are @substrate/connect's main functionalities?

Connecting to a Substrate Node

This feature allows you to establish a connection to a Substrate-based blockchain node using a WebSocket endpoint. The code sample demonstrates how to connect to a Polkadot node.

const { connect } = require('@substrate/connect');

async function main() {
  const api = await connect('wss://rpc.polkadot.io');
  console.log('Connected to the node');
}

main();

Handling Different Network Environments

This feature provides the ability to specify the network environment when connecting to a node. The code sample shows how to connect to the Polkadot network specifically.

const { connect } = require('@substrate/connect');

async function main() {
  const api = await connect('wss://rpc.polkadot.io', { network: 'polkadot' });
  console.log('Connected to the Polkadot network');
}

main();

Interacting with Blockchain Data

This feature allows you to interact with blockchain data once connected. The code sample demonstrates how to retrieve and log the name of the blockchain you are connected to.

const { connect } = require('@substrate/connect');

async function main() {
  const api = await connect('wss://rpc.polkadot.io');
  const chain = await api.rpc.system.chain();
  console.log(`You are connected to chain ${chain}`);
}

main();

Other packages similar to @substrate/connect

FAQs

Package last updated on 26 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