![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
@polkadot/rpc-provider
Advanced tools
Changelog
9.3.1 Sep 3, 2022
Changes:
pendingRewards
return typeAccountId33
(raw/compressed 33-byte ecdsa)Readme
Generic transport providers to handle the transport of method calls to and from Polkadot clients from applications interacting with it. It provides an interface to making RPC calls and is generally, unless you are operating at a low-level and taking care of encoding and decoding of parameters/results, it won't be directly used, rather only passed to a higher-level interface.
There are three flavours of the providers provided, one allowing for using HTTP as a transport mechanism, the other using WebSockets, and the third one uses substrate light-client through @substrate/connect. It is generally recommended to use the [[WsProvider]] since in addition to standard calls, it allows for subscriptions where all changes to state can be pushed from the node to the client.
All providers are usable (as is the API), in both browser-based and Node.js environments. Polyfills for unsupported functionality are automatically applied based on feature-detection.
Installation -
yarn add @polkadot/rpc-provider
WebSocket Initialization -
import { WsProvider } from '@polkadot/rpc-provider';
// this is the actual default endpoint
const provider = new WsProvider('ws://127.0.0.1:9944');
const version = await provider.send('client_version', []);
console.log('client version', version);
HTTP Initialization -
import { HttpProvider } from '@polkadot/rpc-provider';
// this is the actual default endpoint
const provider = new HttpProvider('http://127.0.0.1:9933');
const version = await provider.send('chain_getBlockHash', []);
console.log('latest block Hash', hash);
@substrate/connect Initialization -
Instantiating a Provider for the Polkadot Relay Chain:
import { ScProvider } from '@polkadot/rpc-provider';
const provider = new ScProvider(ScProvider.WellKnownChain.polkadot);
await provider.connect();
const version = await provider.send('chain_getBlockHash', []);
Instantiating a Provider for a Polkadot parachain:
import { ScProvider } from '@polkadot/rpc-provider';
const polkadotProvider = new ScProvider(ScProvider.WellKnownChain.polkadot);
const parachainProvider = new ScProvider(parachainSpec, polkadotProvider);
await parachainProvider.connect();
const version = await parachainProvider.send('chain_getBlockHash', []);
FAQs
Transport providers for the API
The npm package @polkadot/rpc-provider receives a total of 82,340 weekly downloads. As such, @polkadot/rpc-provider popularity was classified as popular.
We found that @polkadot/rpc-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.