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

doughnut-js

v1.0.1

Published

Doughnut API for DAPP.

Downloads

3

Readme

doughnut-js

Doughnut API for DAPP.

Javascript SDK for Doughnut Dapp.

Installation

npm install doughnut-js

Usage

Npm

var donut = require('doughnut-js')
console.log(donut.isConnected());

Browser

<script src="./dist/donut.min.js"></script>
<script>
    console.log(donut.isConnected());
</script>

Contents

1. API

1.1 donut.isConnected

donut.isConnected()

1.2 donut.getAppInfo

donut.getAppInfo()
Returns

Object:

  • result: Boolean
  • data: Object
    • name: String
    • system: String
    • version: String
    • sys_version: String
  • msg: String
Example
donut.getAppInfo().then(console.log)

> {
    result: true,
    data: {
        name: 'Doughnut',
        system: 'android',
        version: '1.1.0',
        sys_version: '24'
    },
    msg: 'success'
}

1.3 donut.getDeviceId

donut.getDeviceId()
Returns

String

Example
donut.getDeviceId().then(console.log)

> "76a4651d-41a2-4580-859a-5ede75d8c75c"

1.4 donut.getCurrentWallet

获取用户当前钱包信息

donut.getCurrentWallet()
Returns

Object:

  • result: Boolean
  • data: Object
    • name: String
    • address: String
  • msg: String
Example
donut.getCurrentWallet().then(console.log)

> {
    result: true,
    data: {
        name: 'test',
        address: 'jBvrdYc6G437hipoCiEpTwrWSRBS2ahXN6',
    },
    msg: 'success'
}

1.5 donut.getWallets

获取用户钱包列表

donut.getWallets()
Returns

Object:

  • result: Boolean
  • data: Array
    • address: String
    • name: String
  • msg: String
Example
donut.getWallets().then(console.log)

> {
    result: true,
    data: [
        {
            name: 'test',
            address: 'jBvrdYc6G437hipoCiEpTwrWSRBS2ahXN6',
        },
        {
            name: 'ceshi',
            address: 'jGqcZ3Zgy9EPaFs89zSv44K8hh7qLsNtBw',
        }
    ],
    msg: 'success'
}

1.6 donut.sign

donut.sign(params)
Parameters

params- Object: tx object

  • to: String
  • currency: Float
  • issuer: String|Object
  • value: String|Object
  • gas: String
  • memo: Number
Returns

Object:

  • result: Boolean
  • signedTx: Stirng
  • msg: String
Example
var tx = {
        "to": "jKBCwv4EcyvYtD4PafP17PLpnnZ16szQsC",
        "currency": "swt",
        "issuer": "",
        "value": "0.001",
        "memo": "test for sign",
        "gas": "0.0001"
      }
donut.sign(tx).then(console.log)

> {
    result: true,
    signedTx: "12000022800000002...E68EA5E58FA3E1F1",
    msg: 'success'
}

1.7 donut.transfer

donut.transfer(params)
Parameters

params- Object: tx object

  • to: String
  • currency: Float
  • issuer: String|Object
  • value: String|Object
  • gas: String
  • memo: Number
Returns

Object:

  • result: Boolean
  • txHash: Stirng
  • msg: String
Example
var tx = {
        "to": "jKBCwv4EcyvYtD4PafP17PLpnnZ16szQsC",
        "currency": "swt",
        "issuer": "",
        "value": "0.001",
        "memo": "test for transfer",
        "gas": "0.0001"
      }
donut.transfer(tx).then(console.log)

> {
    result: true,
    txHash: "092DD86EF938CFBE344BC26AAA0F36DAE3632535B5439B9CB5BDBD5693691B69",
    msg: 'success'
}

1.8 donut.invokeQRScanner

扫码

donut.invokeQRScanner()
Returns

String

Example
donut.invokeQRScanner().then(console.log)

> "jKBCwv4EcyvYtD4PafP17PLpnnZ16szQsC"

1.9 donut.back

donut.back()
Example
donut.back()

1.10 donut.close

donut.close()
Example
donut.close()

1.11 donut.fullScreen

donut.fullScreen(params)
Parameters

params: String 1 - fullScreen, 0 - cancel

Example
donut.fullScreen(1)

1.12 donut.shareToSNS

donut.shareToSNS(params)
Parameters

params- Object: object

  • title: String
  • url: Float
  • text: String|Object
  • imgUrl: String|Object
Example
var params = {
	"title": "js分享",
	"url": "https://github.com/HFJingchuang/doughnut-js",
	"text": "js分享测试",
	"imgUrl": "http://www.someserver.com/测试图片网络地址.jpg"
}
donut.shareToSNS(params)