fix client creation with object example
Fixes GH-10
This commit is contained in:
parent
7121708a5f
commit
107bb99d44
24
README.md
24
README.md
@ -4,16 +4,7 @@ node-bitcoin is a simple wrapper for the Bitcoin client's JSON-RPC API.
|
||||
|
||||
The API is equivalent to the API document [here](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list).
|
||||
The methods are exposed as lower camelcase methods on the `bitcoin.Client`
|
||||
object.
|
||||
|
||||
You can choose to ignore the helper methods and call the api directly like so:
|
||||
|
||||
```js
|
||||
client.cmd('getbalance', '*', 6, function(err, balance){
|
||||
if (err) return console.log(err);
|
||||
console.log('Balance:', balance);
|
||||
});
|
||||
```
|
||||
object, or you may call the API directly using the `cmd` method.
|
||||
|
||||
## Install
|
||||
|
||||
@ -50,17 +41,24 @@ var client = new bitcoin.Client('localhost', 8332, 'username', 'password');
|
||||
var client = new bitcoin.Client({
|
||||
host: 'localhost',
|
||||
port: 8332,
|
||||
username: 'username',
|
||||
password: 'password'
|
||||
user: 'username',
|
||||
pass: 'password'
|
||||
});
|
||||
```
|
||||
|
||||
### Get balance across all accounts with minimum confirmations of 6
|
||||
|
||||
```js
|
||||
|
||||
client.getBalance('*', 6, function(err, balance) {
|
||||
if (err) return console.log(err);
|
||||
console.log('Balance:', balance);
|
||||
});
|
||||
```
|
||||
### Getting the balance directly using `cmd`
|
||||
|
||||
```js
|
||||
client.cmd('getbalance', '*', 6, function(err, balance){
|
||||
if (err) return console.log(err);
|
||||
console.log('Balance:', balance);
|
||||
});
|
||||
```
|
||||
|
||||
Loading…
Reference in New Issue
Block a user