/slyk-sdk-node

Slyk SDK - Node.js

Primary LanguageJavaScript



Slyk


Slyk - Node.js SDK


node NPM Travis (.org) branch Coveralls github

Table of contents

This library allows you to quickly integrate Slyk with your Node.js application.

For additional information and documentation please visit our developers page.

Install

$ yarn add @slyk/slyk-sdk-node

The slyk-sdk-node requires node v8.12 or higher.

Usage

Example

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

import slykSDK from '@slyk/slyk-sdk-node';

(async () => {
  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);
})();

Result

[
  { "amount": "0.50000000", "assetCode": "btc" },
  { "amount": "25.50000000", "assetCode": "usd" }
]