Skip to content
Snippets Groups Projects
Commit c86ec659 authored by Jason Salyers's avatar Jason Salyers
Browse files

[JES] Updates to hive-js for an updated get_account_history API call

parent 93efc5c2
No related branches found
No related tags found
1 merge request!12[JES] Updates to hive-js for an updated get_account_history API call
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
"debug": "^2.6.8", "debug": "^2.6.8",
"detect-node": "^2.0.3", "detect-node": "^2.0.3",
"ecurve": "^1.0.5", "ecurve": "^1.0.5",
"jsbi": "^3.1.4",
"lodash": "^4.16.4", "lodash": "^4.16.4",
"retry": "^0.12.0", "retry": "^0.12.0",
"secure-random": "^1.1.2", "secure-random": "^1.1.2",
......
...@@ -214,6 +214,11 @@ export default [ ...@@ -214,6 +214,11 @@ export default [
"method": "get_account_history", "method": "get_account_history",
"params": ["account", "from", "limit"] "params": ["account", "from", "limit"]
}, },
{
"api": "database_api",
"method": "get_account_history",
"params": ["account", "from", "limit", "operation_filter_low", "operation_filter_high"],
},
{ {
"api": "database_api", "api": "database_api",
"method": "get_owner_history", "method": "get_owner_history",
......
...@@ -58,7 +58,19 @@ export default class HttpTransport extends Transport { ...@@ -58,7 +58,19 @@ export default class HttpTransport extends Transport {
} }
debug('Steem::send', api, data); debug('Steem::send', api, data);
const id = data.id || this.id++; const id = data.id || this.id++;
const params = [api, data.method, data.params]; 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];
}
//END SPECIAL CODE
const retriable = this.retriable(api, data); const retriable = this.retriable(api, data);
const fetchMethod = this.options.fetchMethod; const fetchMethod = this.options.fetchMethod;
if (retriable) { if (retriable) {
......
...@@ -16,4 +16,8 @@ module.exports = { ...@@ -16,4 +16,8 @@ module.exports = {
template: require('./src/template'), template: require('./src/template'),
number_utils: require('./src/number_utils'), number_utils: require('./src/number_utils'),
ChainTypes: require ('./src/ChainTypes'),
makeBitMaskFilter: require('./src/makeBitMaskFilter'),
} }
var ChainTypes; var ChainTypes = {};
module.exports = ChainTypes = {};
ChainTypes.reserved_spaces = { ChainTypes.reserved_spaces = {
relative_protocol_ids: 0, relative_protocol_ids: 0,
...@@ -86,3 +84,5 @@ ChainTypes.object_type = { ...@@ -86,3 +84,5 @@ ChainTypes.object_type = {
"null": 0, "null": 0,
base: 1, base: 1,
}; };
module.exports = ChainTypes;
import JSBI from 'jsbi';
let makeBitMaskFilter = (allowedOperations) => {
return allowedOperations.reduce(([low, high], allowedOperation) => allowedOperation < 64 ? [JSBI.bitwiseOr(low, JSBI.leftShift(JSBI.BigInt(1), JSBI.BigInt(allowedOperation))), high]
: [low, JSBI.bitwiseOr(high, JSBI.leftShift(JSBI.BigInt(1), JSBI.BigInt(allowedOperation-64)))],
[JSBI.BigInt(0), JSBI.BigInt(0)]).map(value => JSBI.notEqual(value, JSBI.BigInt(0)) ? value.toString() : null);
};
module.exports = makeBitMaskFilter;
\ No newline at end of file
...@@ -1997,6 +1997,11 @@ js-yaml@^3.5.1: ...@@ -1997,6 +1997,11 @@ js-yaml@^3.5.1:
argparse "^1.0.7" argparse "^1.0.7"
esprima "^4.0.0" esprima "^4.0.0"
jsbi@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-3.1.4.tgz#9654dd02207a66a4911b4e4bb74265bc2cbc9dd0"
integrity sha512-52QRRFSsi9impURE8ZUbzAMCLjPm4THO7H2fcuIvaaeFTbSysvkodbQQXIVsNgq/ypDbq6dJiuGKL0vZ/i9hUg==
jsbn@~0.1.0: jsbn@~0.1.0:
version "0.1.1" version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
......
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