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

Add getNrgPrice Java API call #500

Merged
merged 4 commits into from
Jun 5, 2018
Merged

Add getNrgPrice Java API call #500

merged 4 commits into from
Jun 5, 2018

Conversation

aionick
Copy link
Contributor

@aionick aionick commented May 22, 2018

Description

Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.

  • The NrgOracle class provides a method to recommend a user an energy price to use, so far only web3 API gives access to this and not Java API. I've added a call to the Java API to access this value. See my other PR in aion_api project that implements the rest of this functionality.

Fixes Issue # N/A.

Type of change

Insert x into the following checkboxes to confirm (eg. [x]):

  • Bug fix.
  • New feature.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

Testing

Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.

  • I added a test to the BaseAPITest in the aion_api project for this. Ran through it in debugger a few times.

Verification

Insert x into the following checkboxes to confirm (eg. [x]):

  • I have self-reviewed my own code and conformed to the style guidelines of this project.
  • New and existing tests pass locally with my changes.
  • I have added tests for my fix or feature.
  • I have made appropriate changes to the corresponding documentation.
  • My code generates no new warnings.
  • Any dependent changes have been made.

@qoire
Copy link
Contributor

qoire commented May 22, 2018

@aionick formatter seems to be taking up most of the code changes, possible for you to point out the specific sections with meaning edits?

Also some of the formatting is problematic especially when it concerns lambdas

@aionick
Copy link
Contributor Author

aionick commented May 22, 2018

My bad I had written that out and meant to comment but forgot. ApiAion0 is the only thing I manually changed here, lines 633-661, the case: Message.Funcs.f_getNrgPrice_VALUE

@aionick
Copy link
Contributor Author

aionick commented May 23, 2018

@qoire The lambda formatting is really annoying, looks like there was an issue raised about this on google's githib here but no response for a few months. I'm tweaking the script to ignore our license atm and I'll see if I can find a workaround for the lambdas

NrgOracle.Strategy oracleStrategy = NrgOracle.Strategy.SIMPLE;

this.nrgOracle = new NrgOracle(bc, nrgPriceDefault, nrgPriceMax, oracleStrategy);
long nrg = this.getRecommendedNrgPrice();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Web3Aion has the same logic, please considering move the NrgOracle logic in both web3 and java api to the abstract class ApiAion

@AionJayT AionJayT merged commit d3a9916 into aionnetwork:master-pre-merge Jun 5, 2018
@AionJayT AionJayT mentioned this pull request Jun 14, 2018
10 tasks
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.

5 participants