Package Exports
- dash
- dash/build/src/index.js
- dash/dist/dash.min.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dash) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Dash SDK
Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)
Dash library allows you to connect to DAPI and receive or broadcast payments on the Dash Network, manage identifies, register data contracts, retrieve or submit documents on the Dash Platform, all within a single library.
Table of Contents
Install
ES5/ES6 via NPM
In order to use this library, you will need to add it to your project as a dependency.
Having NodeJS installed, just type : npm install dash
in your terminal.
npm install dash
CDN Standalone
For browser usage, you can also directly rely on unpkg :
<script src="https://unpkg.com/dash"></script>
Usage
const Dash = require("dash"); // or import Dash from "dash"
const client = new Dash.Client({
network: "testnet",
wallet: {
mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate",
},
});
// Accessing an account allow you to transact with the Dash Network
client.getWalletAccount().then(async (account) => {
console.log("Funding address", account.getUnusedAddress().address);
const balance = account.getConfirmedBalance();
console.log("Confirmed Balance", balance);
if(balance > 0){
// Creating an identity is the basis of all interactions with the Dash Platform
const identity = await client.platform.identities.register()
// Prepare a new document containing a simple hello world sent to a hypothetical tutorial contract
const document = await platform.documents.create(
'tutorialContract.note',
identity,
{ message: 'Hello World' },
);
// Broadcast the document into a new state transition
await platform.documents.broadcast({create:[document]}, identity);
}
});
Primitives and essentials
Dash SDK bundled into a standalone package, so that the end user never have to worry about mananaging polyfills or related dependencies
const Dash = require('dash')
const {
Essentials: {
Buffer // Node.JS Buffer polyfill.
},
Core: { // @dashevo/dashcore-lib essentials
Transaction,
PrivateKey,
BlockHeader,
},
PlatformProtocol: { // @dashevo/dpp essentials
Identity,
Identifier,
},
WalletLib: { // @dashevo/wallet-lib essentials
EVENTS
},
DAPIClient, // @dashevo/dapi-client
} = Dash;
Dependencies
The Dash SDK works using multiple dependencies that might interest you:
- Wallet-Lib - Wallet management for handling, signing and broadcasting transactions (BIP-44 HD).
- Dashcore-Lib - Provides the main L1 blockchain primitives (Block, Transaction,...).
- DAPI-Client - Client library for accessing DAPI endpoints.
- DPP - Implementation (JS) of Dash Platform Protocol.
Some features might be more extensive in those libs, as Dash SDK only wraps around them to provide a single interface that is easy to use (and thus has less features).
Documentation
More extensive documentation available at https://dashevo.github.io/platform/SDK/.
Contributing
Feel free to dive in! Open an issue or submit PRs.
License
MIT © Dash Core Group, Inc.