A Gatecoint API client for browser and Node.js.
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);
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
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';
Running unit tests:
npm t
Coverage report available in coverage/lcov-report
.
To run end-to-end tests:
- 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
- Run
npm run test:e2e
To test the resulting builds:
- Build the library and register it for linkage:
npm run build
npm link
- Go to the tests, install dependencies and link the library
cd test-build
npm i
npm link gatecoin-api-v1
- To test the Node.js build run
npm run test-node
. - To test the web build
npm run test-web
and openhttp://localhost:10001
in your browser.
docker build .
@todo