-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Get contract name in ToJson #2039
Conversation
We might want to extend manifests to include some name for all contracts, btw. Neo 2 had that metadata and it allowed contract explorers to show something more meaningful than just hashes. |
Yes, might add it later. |
Co-authored-by: Luchuan <[email protected]>
Done |
@shargon Shall we merge? |
Please take a look, I don't like to make difference between native and not native. |
May I ask why you need to get the name of the contract in json? Isn't this public information? They can be hard-coded into the SDK. |
I think any contract should have a name. |
I also think so. But how should they display their names? Some contracts use the |
As neo-project/neo-modules#355 said, although hash is necessary, name/ID is more convenient to remember as one of the contract infos. I think we have duty to make it more friendly for development. And as @roman-khimov said, maybe we could make name and contact as required when deploying as neo2 did (neo2 get name in contract state from what they input when deploying) or we could make a check on name from manifest to ensure it contains name and return error msg when it's null. |
Agree |
Manifests are probably more appropriate for this, both native and non-native contracts could have a field there for name. |
Then we should modify NEP-5 and other standards, and remove the |
I think that it will be easier with name method, I can change the code to execute |
|
Wouldn't it be more convenient to use NNS. For me, we'd better keep BTW, multiple contracts can also have the same |
Merge from master
Now, we can move on |
|
Merge neo master
@roman-khimov @shargon @erikzhang Please review again. |
|
||
json["isnative"] = false; | ||
} | ||
|
||
json["hash"] = ScriptHash.ToString(); | ||
json["script"] = Convert.ToBase64String(Script); | ||
json["manifest"] = Manifest.ToJson(); |
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.
The name is included in the manifest
, and I think we don't need to add it to the top level of the json.
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.
The name is included in the
manifest
, and I think we don't need to add it to the top level of the json.
Agree. I'll close this.
Related: neo-project/neo-modules#378
Partly support: neo-project/neo-modules#355
Enable get name in ToJson.