fix: linting
This commit is contained in:
@@ -15,7 +15,6 @@ module.exports = {
|
|||||||
indent: ['warn', 2],
|
indent: ['warn', 2],
|
||||||
'linebreak-style': ['error', 'unix'],
|
'linebreak-style': ['error', 'unix'],
|
||||||
'lines-between-class-members': ['warn', 'always'],
|
'lines-between-class-members': ['warn', 'always'],
|
||||||
quotes: ['error', 'single'],
|
|
||||||
semi: ['error', 'always'],
|
semi: ['error', 'always'],
|
||||||
'new-cap': 'off',
|
'new-cap': 'off',
|
||||||
'no-console': 'off',
|
'no-console': 'off',
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class RequestUtil {
|
|||||||
|
|
||||||
this.baseUrl = baseUrls[livenet === true ? 'livenet' : 'testnet'];
|
this.baseUrl = baseUrls[livenet === true ? 'livenet' : 'testnet'];
|
||||||
if (options.baseUrl) {
|
if (options.baseUrl) {
|
||||||
this.baseUrl = options.baseUrl
|
this.baseUrl = options.baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.globalRequestOptions = {
|
this.globalRequestOptions = {
|
||||||
@@ -35,7 +35,7 @@ module.exports = class RequestUtil {
|
|||||||
headers: {
|
headers: {
|
||||||
Referer: 'bybitapinode'
|
Referer: 'bybitapinode'
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
assert(secret, 'Secret is required for private enpoints');
|
assert(secret, 'Secret is required for private enpoints');
|
||||||
@@ -108,27 +108,27 @@ module.exports = class RequestUtil {
|
|||||||
requestOptions: options
|
requestOptions: options
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
if (!e.response) {
|
if (!e.response) {
|
||||||
// Something happened in setting up the request that triggered an Error
|
// Something happened in setting up the request that triggered an Error
|
||||||
if (!e.request) {
|
if (!e.request) {
|
||||||
throw e.message;
|
throw e.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
// request made but no response received
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// request made but no response received
|
// The request was made and the server responded with a status code
|
||||||
throw e;
|
// that falls out of the range of 2xx
|
||||||
}
|
throw {
|
||||||
|
code: e.response.statusCode,
|
||||||
// The request was made and the server responded with a status code
|
message: e.response.message,
|
||||||
// that falls out of the range of 2xx
|
body: e.response.body,
|
||||||
throw {
|
requestOptions: options,
|
||||||
code: e.response.statusCode,
|
headers: e.response.headers
|
||||||
message: e.response.message,
|
};
|
||||||
body: e.response.body,
|
});
|
||||||
requestOptions: options,
|
|
||||||
headers: e.response.headers
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_signRequest(data) {
|
_signRequest(data) {
|
||||||
@@ -156,14 +156,9 @@ module.exports = class RequestUtil {
|
|||||||
return this._syncTimePromise;
|
return this._syncTimePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._syncTimePromise = new Promise(async (resolve, reject) => {
|
this._syncTimePromise = this.getTimeOffset().then(offset => {
|
||||||
try {
|
this._timeOffset = offset;
|
||||||
this._timeOffset = await this.getTimeOffset();
|
this._syncTimePromise = null;
|
||||||
this._syncTimePromise = null;
|
|
||||||
resolve();
|
|
||||||
} catch (err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return this._syncTimePromise;
|
return this._syncTimePromise;
|
||||||
|
|||||||
Reference in New Issue
Block a user