Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@substrate/connect
Advanced tools
Substrate-connect to Smoldot clients. Using either substrate extension with predefined clients or an internal smoldot client based on chainSpecs provided.
This is a prototype for using @polkadot/api with the smoldot WASM light client either by passing chainspecs or using the extension by predefined chains (e.g. westend, kusama).
Detector check existence of substrate extension. If it is installed and activated then smoldot clients of extension will be used. If not, a new smoldot client will start and sync with given chainspecs.
Provide a known Chain Name ('kusama', 'polkadot', 'westend', 'rococo'):
import { Detector } from '@substrate/connect';
const detect = new Detector('my cool unstoppable app');
const api = await detect.connect('westend');
or provide your custom substrate chain's name and chainspec:
import { Detector } from '@substrate/connect';
import mySubstrateChainSpec from './mySubstrateChainSpec.json';
const chainSpec = JSON.stringify(mySubstrateChainSpec);
const detect = new Detector('my cool unstoppable app');
const api = await detect.connect({ name: 'mySubstrateChainName', spec: chainSpec });
For parachain support, you can providethe parachain's specs
import { Detector } from '@substrate/connect';
import myParaChainSpec from './myParaChainSpec.json';
const parachainSpec = JSON.stringify(myParaChainSpec);
const detect = new Detector('my cool unstoppable app');
const api = await detect.connect('westend', parachainSpec);
In addition besides substrate chain's name and/or chainspec, a list of options can be passed to Detector, same way as in as passed in @polkadot/api. Without chainspec:
import { Detector } from '@substrate/connect';
const detect = new Detector('my cool unstoppable app');
const options = { /* the options as per polkadot/api */ } as ApiOptions;
const api = await detect.connect('mySubstrateChainName', undefined, options);
or with:
import { Detector } from '@substrate/connect';
import mySubstrateChainSpec from './mySubstrateChainSpec.json';
const chainSpec = JSON.stringify(mySubstrateChainSpec);
const detect = new Detector('my cool unstoppable app');
const options = { /* the options as per polkadot/api */ } as ApiOptions;
const api = await detect.connect({ name: 'mySubstrateChainName', spec: chainSpec }, undefined options);
yarn test
to run the unit testsyarn build
to build @substrate-connectyarn lint
to run linter for @substrate-connectFAQs
Substrate-connect to Smoldot clients. Using either substrate extension with predefined clients or an internal smoldot client based on chainSpecs provided.
The npm package @substrate/connect receives a total of 73,359 weekly downloads. As such, @substrate/connect popularity was classified as popular.
We found that @substrate/connect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.