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
feat: transaction to JSON #54
Conversation
misc: merge from upstream
- 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.
@sleepdefic1t Thanks for submitting this pull request, a maintainer will get back to you shortly! |
@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. |
drop 'std::vector<std::pair<const char *const, std::string>>' for std::map<std::string, std::string>.
@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! |
use 'strcpy', 'strcat', and 'sprintf'.
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
This should be good to go now, @faustbrian 👍 |
@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! |
@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. |
Proposed changes
The current implementation does not have a
Transaction::toJson()
method, and does not use a Json library.This PR adds the following
src/
&test/
).helpers/json.h
header for ArduinoJson presets and include statement.Message
classmessage.cpp
to use Json.toString()
method inmessage.cpp
.Message
class to reflect Json lib addition.Transaction
classTransaction::toArray()
method to serve as data source forTransaction::toJson()
method.Transaction::toArray()
tests.Transaction::toJson()
method.Transaction::toJson()
tests.Types of changes
Checklist
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