• 1.0.0 db3e6086b0

    jpcx released this 2021-09-13 19:40:33 -07:00 | 14 commits to main since this release

    MIGRATION FROM 0.4.1:

    The entire project has been completely rewritten using TypeScript and many features have changed.

    If you're upgrading, please review the changes and upgrade guide below.

    Note: if upgrading to 2.1.0, please see the updated migration guide instead

    Added

    • Complete WS 1.8.3 functionality
    • Typings
    • New REST methods

    Removed

    • Custom response parsing
      • To ensure type consistency, it is best to leave parsing to the user.
    • Ratelimiting
      • The aim of this API is to maximize clear and accurate communication with the server.
    • retryCt setting
      • This was originally included due to the occasional nonce and timeout error.
        • To reduce this possibility, increase your API key nonce window and the .timeout setting.
    • REST syncing
      • With the introduction of the WebSocket connection, REST syncing is no longer required for many data sources.
        • For all other sources, simply use an asynchronous loop.
    • Method name settings
      • Previously, settings were used to differentiate between public and private methods rather than requiring the user to specify for each call.
      • Instead, named requests are provided to hard-code these differences.
    • Direct construction using module.exports()
      • Changed to class export for modern standards.

    Changed

    • .call(): replaced by .request()
      • .request() now accepts four arguments: endpoint, options, public|private, utf8|binary.
    • .setOTP(): replaced by the .genotp setting.
    • Errors have changed to named classes. Please review the synopsis.

    Upgrade Guide

    1. Replace all calls to .call() with the corresponding named method.
      • Make sure to view the expected response types; they have changed since 0.4.1.
      • Alternatively, use .request():
        • .call("Assets", { pair: "XXBTZUSD" }, (response) => ...); -> .request("Assets", { pair: "XXBTZUSD" }).then(...);
        • .call("Balance").then(...); -> .request("Balance", "private").then(...);
    2. Replace all sync instances with an async loop that requests every few seconds.
      • If you are syncing one of the endpoints provided by WS, use that instead.
    3. Ensure that your REST calls are not being made too quickly.
      • Ratelimiting has been removed; you may encounter server errors if you were relying on the limiter.
      • See the rate limits documentation.
    4. Increase your api key nonce window if you're getting invalid nonce errors.
      • Calls may now be performed concurrently; 0.4.1 queued calls to guarantee nonce order.
    5. Remove calls to .setOTP(); provide .genotp in the settings.
    6. Review the error classes; if you were parsing errors you will need to update your catch statements.
      • Note: calls are no longer automatically retried retryCt times.
    7. If you're constructing using module.exports (e.g. const kraken = require('node-kraken-api')({...})), you will need to use the module.exports.Kraken class instead: import { Kraken } from "node-kraken-api"; const kraken = new Kraken({...});
    Downloads