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

Fixes Transaction.ToJson() #1071

Merged
merged 4 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neo.UnitTests/Network/P2P/Payloads/UT_Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ public void ToJson()
((JArray)jObj["cosigners"]).Count.Should().Be(0);
jObj["net_fee"].AsString().Should().Be("0");
jObj["script"].AsString().Should().Be("4220202020202020202020202020202020202020202020202020202020202020");
jObj["sys_fee"].AsNumber().Should().Be(42);
jObj["sys_fee"].AsString().Should().Be("4200000000");
}
}
}
4 changes: 2 additions & 2 deletions neo/Network/P2P/Payloads/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ public JObject ToJson()
json["version"] = Version;
json["nonce"] = Nonce;
json["sender"] = Sender.ToAddress();
json["sys_fee"] = new BigDecimal(SystemFee, NativeContract.GAS.Decimals).ToString();
json["net_fee"] = new BigDecimal(NetworkFee, NativeContract.GAS.Decimals).ToString();
json["sys_fee"] = SystemFee.ToString();
json["net_fee"] = NetworkFee.ToString();
json["valid_until_block"] = ValidUntilBlock;
Copy link
Member

Choose a reason for hiding this comment

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

in FromJson are good parsed, so obviously here is wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

FromJson() was added with the RPC SDK. So it is inconsistent. But it's fine now.

json["attributes"] = Attributes.Select(p => p.ToJson()).ToArray();
json["cosigners"] = Cosigners.Select(p => p.ToJson()).ToArray();
Expand Down