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

@bryanwb/dai-shell

v0.0.6

Published

An interactive shell and command-line interface for dai.js

Downloads

12

Readme

@bryanwb/dai-shell

An interactive shell and command-line interface for dai.js

oclif Version Downloads/week License

Usage

$ npm install -g @bryanwb/dai-shell
$ dai COMMAND
running command...
$ dai (-v|--version|version)
@bryanwb/dai-shell/0.0.5 linux-x64 node-v10.15.0
$ dai --help [COMMAND]
USAGE
  $ dai COMMAND
...

Getting Started

Next, you will want to configure dai-shell with an account. Run the dai init command and a helpful wizard will walk you through adding your credentials. Note that dai-cli has the option to store the name of an environment variable to source your private key from. When you tell dai-cli to use an environment variable it only saves the name of that variable to disk and not your actual private key. dai init will also ask you for you infura API key. This value is written to disk.

Subsequent configuration changes can be made with the dai config subcommand. Of special interest is the ability to add multiple accounts with the dai config add subcommand and switch the default account with the dai config switch [accountName] subcommand.

Up and Running

Run dai shell to start a shell connected to a chain. Note that this is a customized node.js REPL w/ special pre-populated variables and support for the await keyword. All pre-populated variables are accessible from the ctx variable:

  • maker: instance of the Maker object connected to the chain specified during dai config add and with the current private key or mnemonic.
  • Maker: The big daddy Maker object
  • wallet: instance of wallet object created from the mnemonic/private key you specified and connected to a network
  • eth: a connection to Ethereum blockchain.
  • utils: utility functions from ethers

Here is an example REPL session:

$ dai repl
Connecting to kovan - https://kovan.infura.io/[REDACTED]
dai> var cdp = await ctx.maker.openCdp()
dai> var result = await cdp.lockEth(0.1, ctx.Maker.ETH)
dai> result.receipt.blockNumber
dai> result.receipt.transactionHash
'0x49195e1dec124de3f3e98af40d499e33d14e73ddde5d56959ceb8981d7ae902a'
dai> cdp = await ctx.maker.getCdp(cdp.id)
dai> var v = await cdp.getCollateralValue()
dai> v.toString()
'0.10 ETH'
dai> result = await cdp.drawDai(5, ctx.Maker.DAI)
dai> var r = await cdp.getCollateralizationRatio()
dai> r
3.0606

Author & License

Copyright 2019 Bryan W. Berry, MIT license