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

EIP-12: Encode/decode box value and token amount from JSON as either a number or a string #346

Merged
merged 25 commits into from
Oct 6, 2021

Conversation

greenhat
Copy link
Member

@greenhat greenhat commented Jul 19, 2021

Close #345

EIP-12

  • parse box value and token amount as either string or number;
  • introduce to_json_dapp() in Transaction and UnsignedTransaction in Wasm that encode box value and token amount as string;
    • Transaction::to_json_dapp();
    • UnsignedTransaction::to_json_dapp();
    • encode BoxValue as string;
    • encode TokenAmount as string;
  • introduce to_json_dapp() in all types that have to_json()
  • change to_json() in ALL types to return text (avoid silent accuracy loss on JS object -> text on JS side);
  • update changelog;

@coveralls
Copy link

coveralls commented Jul 19, 2021

Pull Request Test Coverage Report for Build 1311666546

  • 31 of 31 (100.0%) changed or added relevant lines in 5 files are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 84.965%

Files with Coverage Reduction New Missed Lines %
ergotree-interpreter/src/eval/downcast.rs 3 90.59%
ergotree-ir/src/serialization/types.rs 7 84.97%
Totals Coverage Status
Change from base Build 1311656382: 0.02%
Covered Lines: 11184
Relevant Lines: 13163

💛 - Coveralls

@greenhat greenhat marked this pull request as ready for review July 21, 2021 09:46
@greenhat greenhat changed the title Encode/decode box value and token amount from JSON as either a number or a string EIP-12: Encode/decode box value and token amount from JSON as either a number or a string Jul 21, 2021
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch from f23bc09 to 82a121e Compare July 29, 2021 13:21
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch from 82a121e to 82404ab Compare July 29, 2021 16:26
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch from 39e0830 to 804108e Compare August 22, 2021 06:32
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch from 05ed5a7 to 6247283 Compare September 13, 2021 11:47
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch 2 times, most recently from dfa8cdd to 7248702 Compare October 6, 2021 10:57
add `serde_with` crate;
to return String instead of JsValue (to avoid silent accuracy loss on
JSON->Text on JS side);
ditch rand impl in `sigma_protocol::crypto_utils` in favor of k256 bundled rand_core;
add `to_json_dapp` for `ErgoBox` and `Token`;
add ErgoBox.to_json_dapp() test in JS;
@greenhat greenhat force-pushed the i345-box-value-token-as-string branch from 7248702 to 8674eb1 Compare October 6, 2021 11:28
@greenhat greenhat merged commit 590d168 into develop Oct 6, 2021
@greenhat greenhat deleted the i345-box-value-token-as-string branch October 6, 2021 11:48
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.

Parse box value from JSON as either a number or a string
2 participants