Skip to content

Commit

Permalink
Update named parameters section on README
Browse files Browse the repository at this point in the history
Added explanation of how you must included a version in the arguments to enable named parameters
  • Loading branch information
toriaezunama authored and Rui Marinho committed Jan 11, 2018
1 parent c035b34 commit 1ccca2d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,20 @@ const [body, headers] = await client.getInfo();

Since version v0.14.0, it is possible to send commands via the JSON-RPC interface using named parameters instead of positional ones. This comes with the advantage of making the order of arguments irrelevant. It also helps improving the readability of certain function calls when leaving out arguments for their default value.

For instance, take the `getBalance()` call written using positional arguments:
You **must** provide a version in the client arguments to enable named parameters.

```js
const client = new Client({ version: '0.15.1' });
```
For instance, take the `getBalance()` call written using positional arguments:
```js
const balance = await new Client().getBalance('*', 0);
```

It is functionally equivalent to using the named arguments `account` and `minconf`, leaving out `include_watchonly` (defaults to `false`):

```js
const balance = await new Client().getBalance({
const balance = await new Client({ version: '0.15.1' }).getBalance({
account: '*',
minconf: 0
});
Expand Down

0 comments on commit 1ccca2d

Please sign in to comment.