
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
@dashevo/dapi-sdk
Advanced tools
It wraps all the work needed to answer to your real need (Tx, Blocks, Balance, UTXO..) and provide easy to use Promise-based method.
This package requires the use of Node >= 8.0.0 and is broadly compatible with modern browsers implementing the ECMAScript 2015 standard or better.
npm i -S dapi-sdk
npm i -S github:dashevo/dapi-sdk
You can check our test folder to see some usage exemples.
//import package
const DAPISDK = require('dapi-sdk');
//Quiter version of possibles options.
const options = {
debug:false,
verbose:false,
errors:false,
warnings:false
};
let SDK = DAPISDK(options);
Where theses options can be (in parenthesis,the default value) :
{
"INSIGHT_SEEDS": [
{
"protocol": "http",
"path": "insight-api-dash",
"base": "51.15.5.18",
"port": 3001
}
]
}
Most of the SDK methods will returns you a Promise.
Therefore depending on your specific needs you can init or call methods of the SDK in a async way :
let API = SDK.Explorer.API;
API
.getLastBlockHeight()
.then(function (height) {
console.log(`last height is ${height}`);
})
API
.getLastBlockHeight(API.getHashFromHeight)
.then(function(hash){
console.log(`Last hash is ${hash}`);
})
});
or using async/await features provided in last NodeJS version :
let height = await SDK.Explorer.API.getLastBlockHeight();
console.log(`last height is ${height}`);
On the API documentation below, and for readability reasons, await will mostly be used.
During developement phase, you might need to have access to the website you want to call your data from. Therefore you have the possibility to add your seed yourself (we might bring default stable server later).
Exemple :
const options = {
STUFF:stuff,
DISCOVER:{
INSIGHT_SEEDS:[{
protocol:"https",
path:'api',
base:"insight.dash.siampm.com",
port: 443
}]
}
};
let SDK = await DAPISDK(options);
After having initiate DAPI-SDK, you will then have access to differents components (à-la framework).
Explorer
will allow you to perform some command on the Insight-API of a masternode (chosen randomnly on a validated list).
As it will use some Discover
methods in order to get the Insight Candidate, calling an Explorer call will first perform an init of Discover (and therefore will fetch and validate the list) before returning the value.
Make a note that this will be performed only once.
Blockchain
will allow you to have access to some components such as : getting an object stored in your in-mem db, or validate multiple blocks, calculate the next difficulty.
The initialization must be done by yourself using : await SDK.Blockchain.init()
in order to beneficiate theses function.
Make note that by default it will connect to a randomnly selected insight-api by websocket and will listen to all block. When a block is emitter by the API, it will add it in the blockchain.
This comportement can be disable by passing to init the corresponding options (see below).
Using SDK.Blockchain.chain
enable you to use the blockchain-spv-dash methods
tools
will allow to access to some of the dependencies of the SDK. Most notably, you have access to :
SDK.tools.util
which correspond to a library of handy stuff such as toHash(hex), compressTarget, expandTarget. API here : dash-utilSDK.tools.bitcore
which correspond to a library used in insight-api, see API here : bitcore-dash-library. Contains elements that allow to generate address, sign/verify a message...FAQs
Client SDK for DASH DAPI.
We found that @dashevo/dapi-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 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.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.