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) Sdk graphql refactoring #42

Merged
merged 21 commits into from
Jun 26, 2019

Conversation

Agupane
Copy link
Contributor

@Agupane Agupane commented Jun 25, 2019

Depends on #41

Description

Now the LivepeerAPI.js file was divided into three different services:

  • delegateService
  • delegatorService
  • protocolService

Each service implements the same logic but using dependency inyection, each one of them could receive the source of the data (graphql or sdk) and use those implementations

The implementations are on ./sdk and ./graphql

Note: the protocolService implements a cache that will be updated periodically using a constant. This will improve the performance of most of the calls

The idea is to abstract the usage of the sdk/graphql to the other functions, if we later on, replace all the sdk implementations with graphql, is simple as change the source of the data on the service

I have also added --harmony flag on node run script in order to enable ES6

adds unitAmountInTokenUnits utils file
Adds createDelegator utils file
Adds tests for getDelegateProtocolNextReward, getDelegateNextReward, getDelegateRewardToDelegators, getDelegatorNextReturn, getMissedRewardCalls
…ance on querys

Adds delegatorService and protocolService with configurable source -> use dependencies injection accept receiving a dataSource (graphql or sdk) for data fetching
@Agupane Agupane self-assigned this Jun 25, 2019
@Agupane Agupane mentioned this pull request Jun 25, 2019
Fixs wrong function calls
Updates service dependencies on sendEmailClaimRewardCall.js
Remoes promise retry from load subscriber, now should be done on the sdk
@Agupane Agupane mentioned this pull request Jun 25, 2019
…ey should be done on the protocolService

Fixes wrong method name
Agupane and others added 2 commits June 25, 2019 17:42
Adds getDelegateRewards on delegateService.js
Adds getDelegateTotalStake on delegateService.js
Fixs tests
@mariano-aguero mariano-aguero merged commit cac5f7b into development Jun 26, 2019
@mariano-aguero mariano-aguero deleted the feature/sdk-graphql-refactoring branch June 26, 2019 19:23
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