Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/get all trustlines of user #298

Merged
merged 2 commits into from
Jan 29, 2020
Merged

Conversation

dohaki
Copy link
Contributor

@dohaki dohaki commented Jan 28, 2020

Add method for relay REST API /users/<user_address>/trustlines to return all trustlines of the requesting user.

I also had to modify the getDecimals method for this. Because we are querying trustlines from multiple networks and these networks have different decimals, we somehow have to get these values via getDecimals. Previously we were doing the respective call way too often and redundantly. I now added a caching mechanism to the method so that less decimals rest api calls are made. The refactoring is not quite in the context of #149 and more in the context of making the current usage more efficient.

Previously we have been doing a lot redundant fetching just to get the
respective decimals of a network.
This introduces a caching mechanism through a closure, so that
significantly lesser rest api calls are triggered without the need
of the user to provide the decimals as options.
@dohaki dohaki requested review from berndbohmeier and a user January 28, 2020 15:18
@codecov-io
Copy link

codecov-io commented Jan 28, 2020

Codecov Report

Merging #298 into master will decrease coverage by 0.54%.
The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #298      +/-   ##
=========================================
- Coverage   63.25%   62.7%   -0.55%     
=========================================
  Files          19      19              
  Lines        1173    1196      +23     
  Branches      220     225       +5     
=========================================
+ Hits          742     750       +8     
- Misses        372     384      +12     
- Partials       59      62       +3
Flag Coverage Δ
#integration 33.19% <16.66%> (-0.23%) ⬇️
#unit 62.7% <58.33%> (-0.55%) ⬇️
Impacted Files Coverage Δ
src/typings.ts 100% <ø> (ø) ⬆️
src/Trustline.ts 73.04% <12.5%> (-4.53%) ⬇️
src/CurrencyNetwork.ts 85% <71.42%> (-12.78%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1dcc32...69f461e. Read the comment docs.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@dohaki dohaki merged commit f017c11 into master Jan 29, 2020
@dohaki dohaki deleted the feature/get-all-trustlines-of-user branch January 29, 2020 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants