Skip to content

Latest commit

 

History

History
110 lines (72 loc) · 1.95 KB

README.md

File metadata and controls

110 lines (72 loc) · 1.95 KB

gatecoin-ts-client

A Gatecoint API client for browser and Node.js.

Usage

Install library

npm i gatecoin-api-v1 --save

Create an instance of the client and use it in your code:

import Client from "gatecoin-api-v1";

const client = new Client({
  publicKey: 'your public key',
  privateKey: 'your private key',
});

const response = await client.getOrderBook('BTCEUR');
console.log(response);

Examples

Check out the examples for hints on implementing common use-case scenarios.

You can execute the examples by compiling them and running them with node:

npm run build
node dist/examples/examples/get-tickers.js

Before running the examples, create a .env file in the root folder with the following values:

BASE_URL=https://api.gatecoin.com/v1
PUBLIC_KEY=your public key
PRIVATE_KEY=your private key

IE11 support

To use this library in IE11 you'll need to install a couple of polyfills.

npm i core-js whatwg-fetch --save

Add them to your project before including the library.

import 'core-js/es6/promise';
import 'core-js/es6/object';
import 'whatwg-fetch';

Development

Unit tests

Running unit tests:

npm t

Coverage report available in coverage/lcov-report.

E2E tests

To run end-to-end tests:

  1. Create a .env file in the root folder with the following values:
BASE_URL=https://api.gatecoin.com/v1
PUBLIC_KEY=your public key
PRIVATE_KEY=your private key
  1. Run npm run test:e2e

Build tests

To test the resulting builds:

  1. Build the library and register it for linkage:
npm run build
npm link
  1. Go to the tests, install dependencies and link the library
cd test-build
npm i
npm link gatecoin-api-v1
  1. To test the Node.js build run npm run test-node.
  2. To test the web build npm run test-web and open http://localhost:10001 in your browser.

CI

docker build .

Publishing

@todo