1.3.1 • Published 10 years ago

test-common-wallet v1.3.1

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

test common wallet

A test Common Wallet object for testing software written to the commonWallet spec.

Inputs

Note common wallet relies on a common blockchain client which can be found here A common wallet instance can be instantiated as follows:

var cw = require('test-common-wallet')({
  network: (network you want to operate on. "testnet" or "mainnet"),
  wif: (your private key in wif format to sign messages and transactions),
  commonBlockchain: (a Common Blockchain client. Read about this in the link above)
});

or

var cw = require('test-common-wallet')({
  network: (network you want to operate on. "testnet" or "mainnet"),
  seed: (a seed to generate a wif ie: "this is a seed"),
  commonBlockchain: (a Common Blockchain client. Read about this in the link above)
});

Functions

//callback should be of the form (err, response)
cw.signMessage("hey there, this is a message", callback);

//this callback should be of the form (err, signedTxHex, txid)
cw.signTransaction((some unsigned transaction hex to sign), callback);

//will create, sign, and (optionally) propagate a transaction. callback should be of (err, response)
cw.createTransaction({
  value: (the amount of btc to be transacted in satoshi),
  destinationAddress: (the address your Common Wallet object will be sending btc to),
  propagate: (true or false if you want to propagate the tx. Will default to false)
}, callback);

//will authenticate with host using wallet address as id
cw.login(host, function(err, res, body) {
  
});

//wraps npm request module with wallet authentication with host, use login() first
cw.request(options, function(err, res, body) {

});

Authentication

Use express-common-wallet middleware with login() and request() functions.

Other Common Wallet Data

In addition to the three functions listed above, a common wallet object will also have these two fields:

  address: (the public address of the wallet)
  network: (the network the wallet is operating on)
1.3.1

10 years ago

1.3.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.0

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago