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

feat: transaction to JSON #54

Merged
merged 19 commits into from Feb 4, 2019

Conversation

Projects
None yet
4 participants
@sleepdefic1t
Copy link
Contributor

sleepdefic1t commented Feb 1, 2019

Proposed changes

The current implementation does not have a Transaction::toJson() method, and does not use a Json library.

This PR adds the following

  • ArduinoJson library
    • adds ArduinoJson lib dep as submodule.
    • adds ArduinoJson lib dep in PIO configs (src/ & test/).
    • adds helpers/json.h header for ArduinoJson presets and include statement.
  • Message class
    • refactors message.cpp to use Json.
    • drops redundant toString() method in message.cpp.
    • updates Message class to reflect Json lib addition.
  • Transaction class
    • adds Transaction::toArray() method to serve as data source for Transaction::toJson() method.
    • adds Transaction::toArray() tests.
    • adds Transaction::toJson() method.
    • adds Transaction::toJson() tests.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (improve a current implementation without adding a new feature or fixing a bug)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build (changes that affect the build system)
  • Docs (documentation only changes)
  • Test (adding missing tests or fixing existing tests)
  • Other... Please describe:

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Using the changes in this PR, I was also able to successfully use the Transaction::toJson() method to build and POST a transaction using Cpp-Client on an ESP32.

https://dexplorer.ark.io/transaction/045bac9efd544c703891d8c5734791672c9c1f67c818eab08824c14d99f90948

sleepdefic1t added some commits Dec 5, 2018

Merge pull request #1 from ArkEcosystem/master
misc: merge from upstream
feat: add json
- add 'ArduinoJson' library dep as submodule.
- add 'ArduinoJson' lib dep in PIO configs ('src/' & 'test/').
- add 'json.h' header for 'ArduinoJson' presets and header.
- refactor 'message.cpp' to use json.
- drop redundant 'toString()' in 'message.cpp'.
- update 'test/message.cpp' to reflect Json usage.
- add 'toArray()' method to 'Transaction' class' to better meet SDK standards and serve as data source for 'toJson()' method.
- add 'tx.toArray()' tests.
- add 'toJson()' method to 'Transaction' class.
- add 'tx.toJson()' tests.
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

ArkEcosystemBot commented Feb 1, 2019

@sleepdefic1t Thanks for submitting this pull request, a maintainer will get back to you shortly!

@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

ArkEcosystemBot commented Feb 1, 2019

@faustbrian @air1one - please review this pull request in the next few days. Be sure to explicitly select labels so I know what's going on.

If no reviewer appears after a week, a reminder will be sent out.

sleepdefic1t added some commits Feb 1, 2019

@sleepdefic1t sleepdefic1t changed the title feat: Json [WIP]feat: Json Feb 1, 2019

sleepdefic1t added some commits Feb 1, 2019

refactor: use map
drop 'std::vector<std::pair<const char *const, std::string>>' for std::map<std::string, std::string>.
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

ArkEcosystemBot commented Feb 1, 2019

@sleepdefic1t The ci/circleci: build-linux-clang-5 job is failing as of 24001fb055a25e205829bc2dd9c5b1f80cc3c067. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

refactor: drop <sstream>
use 'strcpy', 'strcat', and 'sprintf'.
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Feb 1, 2019

Codecov Report

Merging #54 into master will increase coverage by 1.27%.
The diff coverage is 86.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #54      +/-   ##
==========================================
+ Coverage   61.76%   63.03%   +1.27%     
==========================================
  Files          40       40              
  Lines        2568     2643      +75     
==========================================
+ Hits         1586     1666      +80     
+ Misses        982      977       -5
Impacted Files Coverage Δ
src/include/cpp-crypto/transactions/transaction.h 0% <ø> (ø) ⬆️
src/utils/message.h 100% <ø> (ø) ⬆️
src/utils/message.cpp 100% <100%> (ø) ⬆️
src/transactions/transaction.cpp 88.7% <84.33%> (+2.66%) ⬆️
src/transactions/builder.cpp 73.33% <0%> (+40%) ⬆️

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 7ba41df...b228b90. Read the comment docs.

@sleepdefic1t sleepdefic1t changed the title [WIP]feat: Json feat: Json Feb 1, 2019

@sleepdefic1t

This comment has been minimized.

Copy link
Contributor Author

sleepdefic1t commented Feb 2, 2019

This should be good to go now, @faustbrian 👍

@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

ArkEcosystemBot commented Feb 4, 2019

@sleepdefic1t A contributor has approved this PR. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait.

Thank you for your contribution!

@faustbrian faustbrian changed the title feat: Json feat: transaction to JSON Feb 4, 2019

@faustbrian faustbrian merged commit b422905 into ArkEcosystem:master Feb 4, 2019

5 checks passed

ci/circleci: build-linux-clang-5 Your tests passed on CircleCI!
Details
ci/circleci: build-linux-default Your tests passed on CircleCI!
Details
ci/circleci: build-linux-gcc7 Your tests passed on CircleCI!
Details
ci/circleci: build-macos-9-2 Your tests passed on CircleCI!
Details
ci/circleci: build-macos-9-3 Your tests passed on CircleCI!
Details
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

ArkEcosystemBot commented Feb 4, 2019

@sleepdefic1t Your pull request has been merged but was not assigned a bounty tier. @faustbrian @air1one - please assign a bounty tier to this pull request in the next few days.

@sleepdefic1t sleepdefic1t referenced this pull request Feb 5, 2019

Merged

chore: Bump Version #56

3 of 12 tasks complete

@sleepdefic1t sleepdefic1t deleted the sleepdefic1t:feat/json branch Feb 15, 2019

ciband added a commit to ciband/cpp-crypto that referenced this pull request Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment