use-ink / ink-docs

Documentation portal for the ink! smart contract language.
https://use.ink
Creative Commons Zero v1.0 Universal
24 stars 72 forks source link

Example code in documentation not working. #275

Closed varshney565 closed 10 months ago

varshney565 commented 1 year ago

https://use.ink/basics/trait-definitions

None of the code in the trait definition is working.

The code of the first example is giving the error ink! trait definitions must not have constructors as shown in the screenshot below.

And When I hover over the code the error given by the analyzer is

All ink! trait definition methods must be ink! messages.
Invalid scope for an #[ink(constructor)] item.

Screenshot from 2023-09-08 10-46-26

New

I have tried switching to the version 4.x.x still got the same error, is there something wrong with the documentation or am I doing it wrong

davidsemakula commented 1 year ago

@varshney565 Not sure if you still need this clarification, but the documentation is indeed wrong in this case. See https://github.com/paritytech/ink-docs/pull/281 for details.

You can also use this other example instead.

cmichi commented 10 months ago

Has been fixed with https://github.com/paritytech/ink-docs/pull/281.