-
Notifications
You must be signed in to change notification settings - Fork 120
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
Improve JSON Output for Upload and Remove Commands #1389
Conversation
Signed-off-by: Tarek <[email protected]>
// Create a JSON object with the events and the removed code hash. | ||
let json_object = serde_json::json!({ | ||
"events": serde_json::from_str::<serde_json::Value>(&output_events)?, | ||
"removed_code_hash": remove_result, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we have removed_code_hash
in JSON format, and in standard printing, we have Code hash
. I think it makes sense to align it.
In the upload command, we have code hash
in both cases; in JSON: code_hash
, and in standard print: Code hash
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think I missed this one.
Which one do you prefer to be used in both cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it could be just code hash
for me, but I am not owner of this repo.
@ascjones do you have any preferences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now renamed it to code_hash
for consistency.
Thanks for your input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit addresses an issue where the JSON output for both the upload and remove commands in cargo contract was in an invalid format. This commit refactors the JSON structure for these commands, resulting in valid JSON objects. Signed-off-by: Tarek <[email protected]>
Signed-off-by: Tarek <[email protected]>
This commit renames the field removed_code_hash to just code_hash in the remove command output to keep it consistent with between json output and human readable output Signed-off-by: Tarek <[email protected]>
fd70f32
to
b156b08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Summary
This PR addresses an issue where the JSON output for both the
upload
andremove
commands in cargo contract was in an invalid format.ink
orpallet-contracts
?Description
This pull request enhances the JSON output for both the
upload
andremove
commands in cargo contract.Previously, the JSON output was in an invalid format, making it challenging to parse and extract information. The modified format now produces valid JSON objects for easier parsing.
Example: JSON Output Before:
Example: JSON Output After:
Checklist before requesting a review
CHANGELOG.md