Skip to content
Snippets Groups Projects
Commit 19b7cc6c authored by Mahdi Yari's avatar Mahdi Yari
Browse files

Merge branch 'fix-account-history' into 'master'

Fix account history

Closes #18

See merge request !20
parents 234c8d40 c2f2ed17
No related branches found
No related tags found
1 merge request!20Fix account history
{
"name": "@hiveio/hive-js",
"version": "0.8.10",
"version": "0.8.11",
"description": "Hive.js the JavaScript API for Hive blockchain",
"main": "lib/index.js",
"scripts": {
......
......@@ -43,6 +43,10 @@ class Hive extends EventEmitter {
};
this[methodName] = (...args) => {
if (methodName === 'getAccountHistory' && args.length < 5) {
methodParams.pop();
methodParams.pop();
}
const options = methodParams.reduce((memo, param, i) => {
memo[param] = args[i]; // eslint-disable-line no-param-reassign
return memo;
......
......@@ -60,16 +60,16 @@ export default class HttpTransport extends Transport {
const id = data.id || this.id++;
let params = [api, data.method, data.params];
//SPECIAL CODE - can be removed after all API node operators upgrade to get the updated get_account_history api call
if (this.options.uri !== 'https://api.hive.blog' && data.method === 'get_account_history' && data.params.length >= 4)
{
//We are experimenting with a new version of get_account_history that can now take up to 5 params
//but this is only deployed on api.hive.blog nodes, so if this particular request is going to a different
//backend, just strip the extra parameters off the call to avoid breaking it. Once all API nodes have upgraded
//this code can be removed.
while (data.params.length > 3)
data.params.pop();
params = [api, data.method, data.params];
}
// if (this.options.uri !== 'https://api.hive.blog' && data.method === 'get_account_history' && data.params.length >= 4)
// {
// //We are experimenting with a new version of get_account_history that can now take up to 5 params
// //but this is only deployed on api.hive.blog nodes, so if this particular request is going to a different
// //backend, just strip the extra parameters off the call to avoid breaking it. Once all API nodes have upgraded
// //this code can be removed.
// while (data.params.length > 3)
// data.params.pop();
// params = [api, data.method, data.params];
// }
//END SPECIAL CODE
const retriable = this.retriable(api, data);
const fetchMethod = this.options.fetchMethod;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment