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 = 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 = 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; //this callback should be of the form (err, signedTxHex, txid)cw; //will create, sign, and (optionally) propagate a transaction. callback should be of (err, response)cw; //will authenticate with host using wallet address as idcw; //wraps npm request module with wallet authentication with host, use login() firstcw;
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)