-
Notifications
You must be signed in to change notification settings - Fork 431
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
Rename name
in metadata to label
#900
Comments
|
Good point and good idea! We should specify this fallback in the follow-up issues for the UI's. |
I agree with everything=) I can rework #859 and add Something like that: #[ink(message)]
#[ink(label = "my_ balance_of")]
fn balance_of(&self, #[ink(label = "my_owner")] owner: AccountId) -> u32 {
self.get().owned_tokens_count.get(&owner).cloned().unwrap_or(0)
} Or it will be implemented later? |
Good to hear :-)!
That would be awesome!
No, let's leave it out for now. |
Hi @cmichi , we had a conversation with @Robbepop regarding #923. He helped me to resolve my issue with overlapping names of methods. Example of how it can be resolved after #665. So for me So if you are okay with it, we can remove it from the scope of this issue. I will re-work the pull request to implement other points of this issue. |
@xgreenx I'm not sure if I understand you right that you suggest to remove |
Yesterday we had a chat and concluded that the |
The original motivation behind this issue was that right now there is no way for a developer to control how UI's display the exposed contract functions. Even worse, a developer has no control over if internal implementation details are exposed (since the trait name is prepended to the metadata field). How is this root issue solved? |
It was kinda decided that it is actually a feature that people cannot take full control over this and instead can rely on a common naming scheme provided by ink!. There are a lot of disadvantages to having this feature that do not weight into the advantage of it. During the chat we found an elegant solution for the problem that caused @xgreenx to require this feature. So there is no more need for this feature from their side, too. We should only ever implement new features (that we have to maintain) if there are good reasons and users. |
Could you elaborate on the disadvantages that you see?
My point still stands, that we have a field for human-readable purposes, but generate the content only from an algorithm without giving the developer any control over it. Right now, our generation exposes internal implementation details by default, without giving the developer any control over if he actually wants it. Why can't uses take full control over it? In my mind, the most basic implementation would just allow |
I agree with @cmichi, that developers better control labels in some cases. I had the case with traits, and it can be resolved by namespacing. But other developers can have a case with common functions in impl block.
I agreed with this idea in this comment. Because the I think that ink! should provide a So I vote for |
Closed via #923 |
In our metadata we currently have a
name
Array field for constructors, messages and arguments.There are some issues with it:
selector
which actually serves as the identifier. There is some concern that users will mistakenly assume that thename
has some implication for the contract execution. Hence renaming it tolabel
would clarify this."name": ["BaseErc20", "new"]
. TheBaseErc20
hereby is a trait implemented by the contract. This exposes internal implementation details of the contract without the developer having any influence over it.Recently there was the PR #859 by @xgreenx where the need for influencing this value in the metadata was also stated.
My proposal is this:
name
tolabel
for constructors, messages and arguments.BaseErc20::new
as String.I'm creating this issue to start a discussion on this. It would be great if especially @seanyoung could give his opinion.
If we decide to do this these would need to be done:
ToDo
name
tolabel
for constructors, messages and arguments.metadata_name
attribute #859, but withlabel
instead ofmetadata_name
. I would leave the possibility of modifying the arguments labels out for now.The text was updated successfully, but these errors were encountered: