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

contract metadata v5 #5594

Closed

Conversation

kziemianek
Copy link

@kziemianek kziemianek commented Apr 14, 2023

Constructor and message metadata is going to contain new attribute named default. The main reason behind adding it is to allow UIs (ex. contracts-ui) determine which one constructor/message should be selected as default in lists.

This is follow-up pull request to use-ink/ink#1703

* support for constructor and message default attribute
@kziemianek kziemianek changed the title metadata v5 contract metadata v5 Apr 14, 2023
@kziemianek
Copy link
Author

I'm not sure if this should go to v4 or v5, finally I've decided to create v5.

selector: 'ContractSelector',
mutates: 'bool',
payable: 'bool',
default: 'bool',
Copy link
Member

@jacogr jacogr Apr 14, 2023

Choose a reason for hiding this comment

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

This is not quite correct - we cannot introduce fields retrospectively to existing versions. In V3 “default” was not available, it is only there from V5+ (Same applies to the V4 preceding it).

Each Vx mapping should accurately reflect the structure of the fields at that point in time.

Copy link
Author

@kziemianek kziemianek Apr 16, 2023

Choose a reason for hiding this comment

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

Ok, thank you. I wasn't certain about versioning here.
Would something like this be ok ?

  ContractMessageSpecV3: 'ContractMessageSpecV2',
  ContractMessageSpecV4: 'ContractMessageSpecV2',
  ContractMessageSpecV5: {
    label: 'Text',
    selector: 'ContractSelector',
    mutates: 'bool',
    payable: 'bool',
    default: 'bool',
    args: 'Vec<ContractMessageParamSpecV2>',
    returnType: 'Option<ContractTypeSpec>',
    docs: 'Vec<Text>'
  },

Copy link
Author

Choose a reason for hiding this comment

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

@jacogr what do you think about my proposition? If it's still not correct, I kindly ask you to explicitly point how to name these types 🙃

@peetzweg
Copy link
Contributor

peetzweg commented May 8, 2023

Would it be smart to adapt the pr to include this change from ink 4.2.0 as well? Otherwise we bump the metadata type version yet again in a short amount of time. 🤔

#5637

@kziemianek kziemianek closed this Aug 3, 2023
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Aug 5, 2023
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.

4 participants