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

dctl

v5.5.0

Published

Get your Dragonchain out of it's shell.

Downloads

79

Readme

DCTL

Get your dragonchain out of its shell.

Description

This commandline tool is a thin wrapper around the dragonchain nodejs sdk using commander.

Usage: dctl [options] [command]

Options:
  -V, --version       output the version number
  -h, --help          output usage information

Commands:
  status|s            Get the status of your chain
  transaction|t       Commands for interfacing with transactions
  transactionType|tt  Commands for interfacing with transaction types
  contract|c          Commands for interfacing with contracts
  block|b             Commands for interfacing with blocks
  creds|k             Manage dragonchain credentials on this machine
  interchain|i        Manage interchains configured for a dragonchain
  help [cmd]          display help for [cmd]

System Requirements

  • NodeJs >= 10.0
  • npm (or equivalent like yarn)
  • docker (for dctl contract test)

Install

Install using NPM

npm install -g dctl

Install using Yarn

yarn global add dctl

Usage Examples

Here is a quick example showing SmartContract creation and invocation:

image

Getting Help

dctl --help
dctl <anyCommand...> --help

Credentials

Adding New Dragonchain Credentials

dctl creds add yourDcIdHere -e http://localhost:8080
ENDPOINT: ...
HMAC KEY ID: UAKRHCSOKTYH
HMAC KEY: ***********************************************
Default Dragonchain set to yourDcIdHere.
Success. New Credentials written to /Users/?/.dragonchain/credentials

Listing Dragonchain Credentials

dctl creds ls
  {
  "default": {
    "dragonchain_id": "..."
  },
  "...": {
    "auth_key": "<hidden>",
    "auth_key_id": "UAKRHCSOKTYH",
    "endpoint": "..."
  }
}

Alias/Shorthand Commands

Most commands/subcommands have a one-letter alias.

dctl t c MyTransactionType 'Hi there!'
{ "status": 201, "response": { "transaction_id": "..." }, "ok": true }

Is equivalent to...

dctl transaction create MyTransactionType 'Hi there!'
{ "status": 201, "response": { "transaction_id": "..." }, "ok": true }

Getting Transactions

dctl transaction get 7d1fa05a-ea6f-44a5-a1b8-8568eb701a8c
{ "status": 201, "response": {...}, "ok": true }

Updating Contracts

dctl c u a57afbb0-9cab-4538-adf8-2fdbce9102fc -A newArg1 -A newArg2
{
  "status": 202,
  "response": {
    "success": {
      "dcrn": "SmartContract::L1::AtRest",
      "version": "1",
      "txn_type": "coolcontract",
      "id": "a57afbb0-9cab-4538-adf8-2fdbce9102fc",
      "status": {
        "state": "Updating",
        "msg": "Contract updating",
        "timestamp": "2019-06-07 17:35:54.720967"
      },
      "image": "dragonchain/interchain-watcher:prod-1.0.0",
      "auth_key_id": null,
      "image_digest": null,
      "cmd": "node",
      "args": [
        "newArg1",
        "newArg2"
      ],
      "env": {
        "address": "0x9DF7aeAD32989b4B533d941d3D799eB302E5A804",
        "network": "custom",
        "customNetworkUrl": "http://10.2.1.123:8545",
        "callbackUrl": "https://callmeback.edu"
      },
      "existing_secrets": null,
      "cron": null,
      "seconds": 6,
      "execution_order": "serial"
    }
  },
  "ok": true
}

Creating Contracts

dctl c c coolcontract dragonchain/interchain-watcher:prod-1.0.0 node index.js -n 6 -s -e '{"myvar":"custom","whatever":"foo"}'
{
  "status": 202,
  "response": {
    "success": {
      "dcrn": "SmartContract::L1::AtRest",
      "version": "1",
      "txn_type": "PrivateEthWatcher",
      "id": "a57afbb0-9cab-4538-adf8-2fdbce9102fc",
      "status": {
        "state": "Pending",
        "msg": "Contract creating",
        "timestamp": "2019-06-07 17:35:54.720967"
      },
      "image": "dragonchain/interchain-watcher:prod-1.0.0",
      "auth_key_id": null,
      "image_digest": null,
      "cmd": "node",
      "args": [
        "index.js"
      ],
      "env": {
        "myvar": "custom",
        "whatever": "foo",
      },
      "existing_secrets": null,
      "cron": null,
      "seconds": 6,
      "execution_order": "serial"
    }
  },
  "ok": true
}

Helpful Jq Alias'

Prerequisites

  • Install the jq package to parse the dctl output.
# ~/.bashrc
alias d-scls="dctl c ls | jq '.response.results[] | [(.txn_type, .id)]' | jq -s ."

Examples

# List Smartcontracts Names, Ids
d-cls

[[
  "coolcontract",
  "4b95544c-d1a0-4f4a-ab9d-a098e3a1ce6a"
],[
  "myContract",
  "7ccfae39-5e93-4ca3-ad9e-7d1edf5ce3c2"
]]

Contributing

Dragonchain is happy to welcome contributions from the community. You can get started here.