From c8932b9107f08a6179aba9b5ef21902d07eb9fd3 Mon Sep 17 00:00:00 2001 From: Jon Eyrick Date: Mon, 26 Mar 2018 01:17:06 -0700 Subject: [PATCH] Change to alternative node (or your own) ```js (async () => { const api = require('skycoin'); api.options({node: 'http://127.0.0.1:6420/'}); console.log(await api.version()); })(); ``` --- skycoin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/skycoin.js b/skycoin.js index faacee0..aadc729 100644 --- a/skycoin.js +++ b/skycoin.js @@ -2,13 +2,13 @@ module.exports = function() { 'use strict'; const axios = require('axios'); const defaults = { + node: 'https://node.skycoin.net/api/', proxy: false, - timeout: 5000 + timeout: 60000 }; - let options = {}; + let options = defaults; async function request(url, data = {}, flags = {}) { - const base = 'https://node.skycoin.net/api/'; const userAgent = 'Mozilla/4.0 (compatible; Node Skycoin API)'; const contentType = 'application/x-www-form-urlencoded'; let headers = { @@ -21,7 +21,7 @@ module.exports = function() { headers: headers, timeout: options.timeout, proxy: options.proxy, - baseURL: base + baseURL: options.node }; if ( typeof flags.method !== 'undefined' ) params.method = flags.method; // GET POST PUT DELETE if ( params.method == 'GET' ) {