hs-wallet
wallet client for handshake blockchain
Last updated 7 months ago by liu9293 .
MIT · Original npm · Tarball · package.json
$ cnpm install hs-wallet 
SYNC missed versions from official npm registry.

hs-wallet

This library is like a subset of hsd which generate raw handshake transactions

Usage

  • Get address with a mnemonic
const handshake = require('hs-wallet')
const mnemonic = '*** *** ***'

const wallet = handshake.fromMnemonic(mnemonic)
const address = wallet.getAddress()
  • Send fund
const utxo = {
  hash: '1ad8539d27fae6bd217ace51f0e23da8eddf121a48e4ac39ca4bff4f1c0c6f8c',
  index: 0,
  value: 1 * 1e6
}

const transaction = wallet.send(
  [utxo],
  toAddress,
  amount, // in satoshis
  fee // satoshis
)

const { txid, hex } = transaction
// then call rpc - sendrawtransaction with hex
  • Bid name
const utxo = {
  hash: '1ad8539d27fae6bd217ace51f0e23da8eddf121a48e4ac39ca4bff4f1c0c6f8c',
  index: 0,
  value: 1 * 1e6
}

const transaction = wallet.bidName(
  'wltx',       // name want to bid
  0.1 * 1e6,    // value, in satoshis
  0.1 * 1e6,    // lock value, must >= value, in satoshis
  2842,         // current block height
  [utxo],       // utxo set
  0.05 * 1e6,    // transaction fee, in satoshis
)

const { txid, hex } = transaction
// then call rpc - sendrawtransaction with hex

Current Tags

  • 0.0.5                                ...           latest (7 months ago)

5 Versions

  • 0.0.5                                ...           7 months ago
  • 0.0.4                                ...           8 months ago
  • 0.0.3                                ...           8 months ago
  • 0.0.2                                ...           8 months ago
  • 0.0.1                                ...           8 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (9)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |