DCore SDK for JS
Set of APIs for accessing the DCore Blockchain.
If you are looking for other platforms you can find info below.
Requirements
Installation
npm install --save rxjs
npm install --save dcorejs-sdk
Make sure you import reflect-metadata
in an entry class to your application, eg. import "reflect-metadata";
To enable debug logging you can use rxjs-spy
.
Usage
You can find example project with SDK usage here.
You can find developer documentation for latest release here.
Use DCoreSdk
to initialize the API.
The DCoreApi
provides different groups of APIs for accessing the blockchain and default configuration values.
The supported operations are located in ch.decent.sdk.model.operation
package, suffixed with Operation
eg. TransferOperation(...)
.
Use the BroadcastApi
to apply the operations to DCore or use appropriate methods in APIs.
Access api using rest
;; // create the API// get account by name, resolves to account id '1.2.27' .subscribeconsole.logaccount.id;
Access api using websocket.
We need to install some websocket library beforehand if we are not running in the browser.
Eg. npm install --save ws
;;;; // debug logging: init rxjs-spy and log all tags;spy.log; // create api for websocket;// create account credentials;// send 1DCT to account id '1.2.28 (public-account-10)' with encrypted 'hello memo' memo .subscribeconsole.logconfirmation.id;