Skip to content

Commit

Permalink
Update README usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmaia committed Mar 26, 2020
1 parent b4e59a8 commit ba77c90
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<br>
<p align="center"><a href="https://slyk.io/"><img width="50" src="docs/media/logo.png" alt="Slyk"></a> - Node.js SDK </p>
<br>
<br>
<p align="center">
<img alt="node" src="https://img.shields.io/node/v/@slyk/slyk-sdk-node">
<img alt="NPM" src="https://img.shields.io/npm/l/@slyk/slyk-sdk-node">
<img alt="Travis (.org) branch" src="https://img.shields.io/travis/slykio/slyk-sdk-node/master">
<img alt="Coveralls github" src="https://img.shields.io/coveralls/github/slykio/slyk-sdk-node?branch=master">
</p>
</div>

![Travis (.org)](https://img.shields.io/travis/slykio/slyk-sdk-node)
[![Coverage Status](https://coveralls.io/repos/github/slykio/slyk-sdk-node/badge.svg?branch=master)](https://coveralls.io/github/slykio/slyk-sdk-node?branch=master)
![NPM](https://img.shields.io/npm/l/@slyk/slyk-sdk-node)
![node](https://img.shields.io/node/v/@slyk/slyk-sdk-node)

## Table of contents
- [Install](#install)
- [Usage](#usage)
Expand All @@ -32,12 +32,32 @@ The `slyk-sdk-node` requires node **v8.6.0** or higher.

## Usage

### Example

```js
const slykSDK = require('@slyk/slyk-sdk-node');

(function() {
const slyk = slykSDK({ apikey: 'api-key' });

slyk.wallet.get('8399340e-8c1f-4c4f-94e0-81a5ee0378e1')
.then(function(wallet) {
wallet.getBalance({ filter: { assetCode: 'in:btc,usd' } })
.then(function(balance) {
console.log(balance);
});
});
})();
```

### ES8 Example

```js
const slykSDK = require('@slyk/slyk-sdk-node');

(async () => {
const slyk = slykSDK({ apikey: 'foobar' });
const wallet = await slyk.wallet.get('3778f28c-5a02-472f-b428-b7b40acf8055');
const slyk = slykSDK({ apikey: 'api-key' });
const wallet = await slyk.wallet.get('8399340e-8c1f-4c4f-94e0-81a5ee0378e1');
const balance = await wallet.getBalance({ filter: { assetCode: 'in:btc,usd' } });

console.log(balance);
Expand Down

0 comments on commit ba77c90

Please sign in to comment.