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

Pretty Print function for Transaction #243

Merged
merged 3 commits into from
Nov 13, 2020
Merged

Conversation

EvanJRichard
Copy link
Contributor

Summary

If you have a built Transaction, then calling console.log(theTxn) does not give very useful information. Addresses are formatted for bytes, for example. This PR proposes to add a prettyPrint() function on class Transaction for user-dev debug.

I am especially looking for feedback on what fields should be edited and how. Currently the focus is on returning addresses to string, the genesis hash displays as b64, and the tag is returned to normal.

Testing

Added a minimal unit test that checks if pretty print throws.

See Also

Closes #240

@jasonpaulos
Copy link
Contributor

Have you thought of overriding toString() instead of/in addition to this new method? Developers would already be familiar with that.

@EvanJRichard
Copy link
Contributor Author

@jasonpaulos good idea - I'll add a toString() that builds the same sort of dict, but instead of printing it, calls JSON.stringify and returns that

Copy link
Contributor

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

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

Looks good!

@EvanJRichard EvanJRichard merged commit d030706 into develop Nov 13, 2020
@EvanJRichard EvanJRichard deleted the evan/prettyprint branch November 13, 2020 19:19
@jasonpaulos jasonpaulos mentioned this pull request Nov 20, 2020
milafilip pushed a commit to milafilip/js-algorand-sdk that referenced this pull request Mar 22, 2023
If you have a built Transaction, then calling console.log(theTxn) does not give very useful information. Addresses are formatted for bytes, for example. This commit adds prettyPrint() and toString() functions on class Transaction for user-dev debug.

Review: algorand/js-algorand-sdk#243
Resolves: algorand/js-algorand-sdk#240
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.

Add pretty-print function to Transaction
2 participants