Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@cennznet/api
Advanced tools
The CENNZNet JavaScript SDK for browsers, RN and Node.js.
@cennznet/crml-*
are peer dependencies to @cennznet/api
, they need to be installed together.
$> npm i --save @cennznet/api @cennznet/crml-generic-asset @cennznet/crml-cennzx-spot @cennznet/crml-attestation
Do not put @plugnet/* or @polkadot/* in your package.json
<Static>
create(options?: ApiOptions | ProviderInterface)
//initialize Api and connect to dev network
const {Api} = require('@cennznet/api')
api = await Api.create({
provider: 'wss://rimu.unfrastructure.io/ws?apikey=***'
});
// For Rxjs
const {ApiRx} = require('@cennznet/api')
api = await ApiRx.create({
provider: 'wss://rimu.unfrastructure.io/ws?apikey=***'
}).toPromise();
if provider is a string url, sdk will chose Provider Class based on url protocol. Or you can initialize the provider Instance yourself.
const {WsProvicer, HttpProvider} = require('@cennznet/api');
api.setSigner(window.SingleSource.signer);
@cennznet/wallet
as Signernpm i --save @cennznet/wallet
const {SimpleKeyring, Wallet} = require('@cennznet/wallet')
wallet = new Wallet();
await wallet.createNewVault('a passphrase');
api.setSigner(wallet);
CRML stand for CENNZNet Runtime Module
After connecting to CENNZNet, api will dynamically create queries and transaction methods.
api.rpc.<section>.<method>
provides access to actual RPC calls, be it for queries, submission or retrieving chain informationapi.query.<section>.<method>
provides access to chain state queries. These are dynamically populated based on what the runtime providesapi.derive.<section>.<method>
provides access to build-in complex state queries which are combination of several basic state queries.api.tx.<section>.<method>
provides the ability to create a transaction, like chain state, this list is populated from a runtime queryWith CRML sdks installed, they will inject themselves in api. api.genericAsset
, api.cennzxSpot
and api.attestation
.
Queries, derive queries and tx methods are provided in under these namespaces.
Dynamic | CRML | |
---|---|---|
Up-To-Date | Always | require upgrade manually |
IDE Hints | None, need to check docs/metadata | accurate typescript type definition |
Addition Validations | None, e.g: transfer might fail if no enough balance. pay tx fee anyway. | Yes. will stop sending tx, e.g: no enough balance |
FAQs
CENNZnet's javascript api
We found that @cennznet/api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.