Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hive-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hive-js
Commits
19b7cc6c
Commit
19b7cc6c
authored
4 years ago
by
Mahdi Yari
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-account-history' into 'master'
Fix account history Closes
#18
See merge request
!20
parents
234c8d40
c2f2ed17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Fix account history
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
package.json
+1
-1
1 addition, 1 deletion
package.json
src/api/index.js
+4
-0
4 additions, 0 deletions
src/api/index.js
src/api/transports/http.js
+10
-10
10 additions, 10 deletions
src/api/transports/http.js
with
15 additions
and
11 deletions
package.json
+
1
−
1
View file @
19b7cc6c
{
"name"
:
"@hiveio/hive-js"
,
"version"
:
"0.8.1
0
"
,
"version"
:
"0.8.1
1
"
,
"description"
:
"Hive.js the JavaScript API for Hive blockchain"
,
"main"
:
"lib/index.js"
,
"scripts"
:
{
...
...
This diff is collapsed.
Click to expand it.
src/api/index.js
+
4
−
0
View file @
19b7cc6c
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
src/api/transports/http.js
+
10
−
10
View file @
19b7cc6c
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment