Server SDK (Node.js)

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

Install

$ yarn add @slyk/slyk-sdk-node

The slyk-sdk-node requires node v4 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" }
]

Last updated