Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Conversation

@codingupastorm
Copy link
Collaborator

No description provided.

/// <summary>
/// Get a string representation of a smart contract execution's return value.
/// </summary>
public static string GetSerializedReturnValue(object returnValue)
Copy link
Collaborator

@rowandh rowandh Nov 25, 2019

Choose a reason for hiding this comment

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

This definitely doesn't belong in the CoinViewRule. We should return the result object, and leave it up to the presentation layer (in this case, the API controller) to decide how to display structs.

Also, we will probably want to reuse this for deserializing local calls to methods where the return type is a struct.

@rowandh
Copy link
Collaborator

rowandh commented Nov 25, 2019

Nice idea 💯 . Would be good if we can make it reusable and apply it in other places where struct deserialization would be useful!

@codingupastorm
Copy link
Collaborator Author

I will do that, will componentise it soon as I get a chance

return null;

// All primitives will come from "a real place". Return the standard string representation.
if (!String.IsNullOrEmpty(returnValue.GetType().Namespace))
Copy link
Contributor

Choose a reason for hiding this comment

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

User lowercase string for consistency

@rowandh
Copy link
Collaborator

rowandh commented Nov 28, 2019

Looks like this problem exists for byte arrays too, see #4099.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants