jupiter-node-sdk
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -72,2 +72,4 @@ /// <reference types="node" /> | ||
params?: any; | ||
body?: any; | ||
dontTest?: boolean; | ||
} | ||
@@ -74,0 +76,0 @@ interface ITransactionAttachment { |
@@ -26,2 +26,3 @@ "use strict"; | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'User-Agent': 'jupiter-node-sdk', | ||
@@ -57,5 +58,3 @@ }, | ||
const { announcedAddress } = peer; | ||
console.log('ACCOUNCED', announcedAddress, peer, peerListCopy); | ||
const isConnected = await this.testConnection(announcedAddress); | ||
console.log('IS', isConnected); | ||
if (isConnected) { | ||
@@ -96,2 +95,3 @@ this.setClient(announcedAddress); | ||
}, | ||
dontTest: true, | ||
}); | ||
@@ -222,3 +222,4 @@ return peers; | ||
// test connection every 5 minutes in case the current node dies | ||
if (Date.now() - this.lastClientTest >= 1000 * 60 * 5) { | ||
if ((!opts || !opts.dontTest) && | ||
Date.now() - this.lastClientTest >= 1000 * 60 * 5) { | ||
assert_1.default(this.client.defaults.baseURL, `current client baseURL is not set for some reason`); | ||
@@ -231,7 +232,13 @@ const isConnected = await this.testConnection(this.client.defaults.baseURL); | ||
switch (verb) { | ||
case 'post': | ||
return await this.client.post(path, undefined, // opts && opts.body | ||
{ | ||
params: opts && opts.params, | ||
case 'post': { | ||
const requestType = (opts && opts.params && opts.params.requestType) || | ||
(opts && opts.body && opts.body.requestType); | ||
let body = opts && { ...opts.body, ...opts.params }; | ||
delete body.requestType; | ||
return await this.client.post(path, body, { | ||
params: { | ||
requestType, | ||
}, | ||
}); | ||
} | ||
default: | ||
@@ -238,0 +245,0 @@ // get |
{ | ||
"name": "jupiter-node-sdk", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A thin wrapper around the Jupiter blockchain APIs.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103902
4499