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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wicc-wallet-lib

v2.1.0

Published

A pure and powerful JavaScript Wicc Wallet library.

Readme

wicc-wallet-utils-js v2.0

Official JavaScript library that provides WICC Offline Wallet capabilities

Installation

CDN

<script src="https://sw91.net/devops/wicc-wallet-utils/wicc-wallet-lib-2.0.0.js"></script>

NPM

npm install wicc-wallet-lib

Usage

const { Wallet, WalletManager, WaykiTransaction, BaasClient } = require("wicc-wallet-lib")

Key Classes

Wallet —— Constructor of a blockchain wallet

Demo

const privKeyWIF = "Y6J4aK6Wcs4A3Ex4HXdfjJ6ZsHpNZfjaS4B9w7xqEnmFEYMqQd13"
const wallet = new Wallet(privKeyWIF) 
//{privateKey: 'Y6J4aK6Wcs4A3Ex4HXdfjJ6ZsHpNZfjaS4B9w7xqEnmFEYMqQd13', address: 'wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4' }

Instance Methods

  • signMessage

    Message signature method

const msg = "wicc test"
const signTx = wallet.signMessage(msg) 
  • publicKeyAsHex

    Get wallet public key

const pubKey = wallet.publicKeyAsHex()

WalletManager —— Constructor of wallet management

Demo

const networkType = "testnet"
var walletManager = new WalletManager(networkType)

Instance Methods

  • randomMnemonicCodes

    Generate a mnemonic randomly

const lang = "ENGLISH" // or CHINESE
const mnemonics = walletManager.randomMnemonicCodes(lang) 
//mnemonics = "clinic dose kingdom fetch away industry squirrel cheese purchase mean slide mixed"
  • switchMnemonicCodes

    Switching from mnemonics in the current language to mnemonics in another language, both can generate the same wallet

var mnemonics1 = walletManager.randomMnemonicCodes("ENGLISH") 
var wallet1 = walletManager.importWalletFromMnemonic(mnemonics)

var mnemonics2 = walletManager.switchMnemonicCodes(mnemonics1, "CHINESE") 
var wallet2 = walletManager.importWalletFromMnemonic(mnemonics2)

wallet1.address === wallet2.address
  • createWallet

    Create a blockchain wallet from valid mnemonics, returns a instance object of Wallet

var wallet = walletManager.createWallet(mnemonics)
  • importWalletFromMnemonic

    Import an existing wallet from its mnemonics

var wallet = walletManager.importWalletFromMnemonic(mnemonics)
  • importWalletFromPrivateKey

    Import an existing wallet from its private key

var wallet = walletManager.importWalletFromPrivateKey(privateKeyWIF)

WaykiTransaction —— Constructor of transaction signature

var wallet = new Wallet(privKeyWIF) 
var txParams = {
  nTxType: 15, // transaction type
  nValidHeight: 34400,    // create height
  srcRegId: '0-1',    // sender's regId
  appId: "24555-1",  // app regId
  feeSymbol: "WICC",
  coinSymbol: "WUSD",
  fees: 1000000,         // fees pay for miner
  amount: 8,              // amount of WICC to be sent to the app account
  vContract: "f018"      // contract method, hex format string
};
var transaction = new WaykiTransaction(txParams, wallet)

Instance Methods

  • genRawTx
var rawTx = transaction.genRawTx()

List of all transactions

| Transaction type | nTxType | Demo | | :------------ |:---------------:| -----:| | ACCOUNT_REGISTER_TX | 2 | test-registeraccounttx.js | | BCOIN_TRANSFER_TX | 3 | test-commontx.js | | LCONTRACT_INVOKE_TX | 4 | test-callcontracttx.js | | LCONTRACT_DEPLOY_TX | 5 | test-registercontracttx.js | | DELEGATE_VOTE_TX | 6 | test-delegatetx.js | | ASSET_ISSUE_TX | 9 | test-assetcreatetx.js | | ASSET_UPDATE_TX | 10 | test-assetupdatetx.js | | UCOIN_TRANSFER_TX | 11 | test-ucointransfertx.js | | UCOIN_CONTRACT_INVOKE_TX | 15 | test-ucontractinvoketx.js | | CDP_STAKE_TX | 21 | test-cdpstaketx.js | | CDP_REDEEMP_TX | 22 | test-cdpredeemtx.js | | CDP_LIQUIDATE_TX | 23 | test-cdpliquidatetx.js | | DEX_LIMIT_BUY_ORDER_TX | 84 | test-dexbuylimitordertx.js | | DEX_LIMIT_SELL_ORDER_TX | 85 | test-dexselllimitordertx.js | | DEX_MARKET_BUY_ORDER_TX | 86 | test-dexbuymarketordertx.js | | DEX_MARKET_SELL_ORDER_TX | 87 | test-dexsellmarketordertx.js | | DEX_CANCEL_ORDER_TX | 88 | test-dexcancelordertx.js |

BaasClient —— Contains some of Baas (Blockchain as a Service) API; HTTP requerts

Demo

var baasClient = new BaasClient(BaasUrl)

| BaasNetwork | BaasUrl | Remarks | | :------------ |:---------------:| -----:| | TestNetwork | https://baas-test.wiccdev.org/v2/api | documentation | | ProdNetwork | https://baas.wiccdev.org/v2/api | documentation |

Instance Methods

  • getAccountInfo

    Get information of a specific wallet address, returns a Promise

const address = "whiRBzMprDzY5wq3oPsHvAnyDV8ggYNaZE"
const response = baasClient.getAccountInfo(address)
response.then(data => {
    console.log(data)
})
  • getBlockCount

    Get the current block height, returns a Promise

const response = baasClient.getBlockCount()
response.then(data => {
    console.log(data)
})
  • sendRawTx

    Broadcast transaction signature data to blockchain, returns a Promise

const rawTx = "0301818c760200011476c6077b5679c8ef47f4243ca25537d5c3f7fad883e1ac009f80e7eeef000d74657374207472616e73666572473045022100e2853b6dfb8a892659de4a43181f8a02e983cca319def2457ea7b0a14c8966ea0220733ce86e172bff8aba750d104b6f39b737c897df7c33413142bd13b2415ce2f2"
const response = baasClient.sendRawTx(rawTx)
response.then(data => {
    console.log(data)
})
  • decodeRawTx

    Get the original transaction detail based on the signature data, returns a Promise

const rawTx = "0301818c760200011476c6077b5679c8ef47f4243ca25537d5c3f7fad883e1ac009f80e7eeef000d74657374207472616e73666572473045022100e2853b6dfb8a892659de4a43181f8a02e983cca319def2457ea7b0a14c8966ea0220733ce86e172bff8aba750d104b6f39b737c897df7c33413142bd13b2415ce2f2"
const response = baasClient.decodeRawTx(rawTx)
response.then(data => {
    console.log(data)
})

Development & Tests

$ git clone https://github.com/WaykiChain/wicc-wallet-utils-js.git
$ cd wicc-wallet-utils-js
$ npm install

Build (you will get a UMD module):

  • Execution Command
$ npm run build 
  • Output
dist/wicc-wallet-lib-2.0.js

Examples

Run all the Demos:

$ npm run test

Reference Projects

bitpay/bitcore-lib

Contact us

To get community assistance and ask for help with implementation questions

  • Telegram group: https://t.me/waykichaindeveng
  • Wechat ID: wjlT2D2

License

Code released under the MIT license.

© 2017-present WaykiChain, Inc.