• 2.1.0 444ede10cb

    jpcx released this 2021-09-16 10:26:09 -07:00 | 9 commits to main since this release

    Added a few (deprecated) legacy settings and .call() to ease the upgrade process.

    • As before, .call() configurably parses responses (dates and numbers by default), but does not use a rate limiter, queueing, or retries.
    • Function signature maintained from 0.4.1.

    Updated 0.4.1 migration guide:

    Added

    • Complete WS 1.8.3 functionality
    • Typings
    • New REST methods

    Deprecated

    • Custom response parsing (Settings.parse, Settings.dataFormatter)
      • To ensure type consistency, it is best to leave parsing to the user.
      • Used only for the deprecated .call() function.
    • Method name settings (Settings.pubMethods, Settings.privMethods)
      • 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.
      • Used only for the deprecated .call() function.
    • .call()
      • Replaced by .request() and the named REST methods.

    Removed

    • Ratelimiting (Settings.limiter and Settings.tier)
      • The aim of this API is to maximize clear and accurate communication with the server; ratelimiting makes assumptions about the client setup and should be left to the user.
    • REST retries (Settings.retryCt)
      • 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 (Settings.syncIntervals)
      • 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.
    • Server Settings (Settings.hostname, Settings.version)
      • These values should be constants.
    • OTP value setting (Settings.otp and .setOTP())
      • Replaced by Settings.genotp
    • Direct construction using module.exports()
      • Changed to class export for modern standards.

    Changed

    • Errors have changed to named classes. Please review the synopsis.

    Upgrade Guide

    1. Replace all calls to .call() with the corresponding named method or .request().
      • Make sure to view the expected response types; they have changed since 0.4.1.
    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 (global queueing is removed).
    5. Remove calls to .setOTP() and Settings.otp; 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