npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dcorejs-sdk

v3.0.3

Published

DcoreJS SDK.

Downloads

8

Readme

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

import "reflect-metadata";
import { DCoreSdk } from "dcorejs-sdk";

// create the API
const api = DCoreSdk.createForHttp({ baseUrl: "https://testnet.dcore.io/" })
// get account by name, resolves to account id '1.2.27'
const disposable = api.accountApi.get("public-account-9")
    .subscribe((account) => console.log(account.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

import "reflect-metadata";
import { AssetFormatter, ChainObject, Credentials, DCoreSdk } from "dcorejs-sdk";
import { create } from "rxjs-spy";
import * as WebSocket from "ws";

// debug logging: init rxjs-spy and log all tags
const spy = create();
spy.log();

// create api for websocket
const api = DCoreSdk.createForWebSocket(() => new WebSocket("wss://testnet-socket.dcore.io/"));
// create account credentials
const credentials = new Credentials(ChainObject.parse("1.2.27"), "5Hxwqx6JJUBYWjQNt8DomTNJ6r6YK8wDJym4CMAH1zGctFyQtzt");
// send 1DCT to account id '1.2.28 (public-account-10)' with encrypted 'hello memo' memo
const disposable = api.accountApi.transfer(credentials, "public-account-10", AssetFormatter.DCT.amount(1), "hello memo")
    .subscribe((confirmation) => console.log(confirmation.id));

Official DCore SDKs for other platforms