shawntabrizi / substrate-collectables-workshop

A guided tutorial for building an NFT marketplace with the Polkadot SDK
https://www.shawntabrizi.com/substrate-collectables-workshop/
MIT License
237 stars 101 forks source link

fix Rust code in 'refactoring-our-code' #156

Closed apopiak closed 4 years ago

apopiak commented 4 years ago

The Rust code on this page had some errors so I fixed it. (Relies on specifying some imports correctly, but so did the original.) Verified to (at least) compile in my personal branch of the workshop.

JoshOrndorff commented 4 years ago

So this means the workshop is no longer compatible with v1.0 right?

Should the instructions be updated accordingly?

Is it a better idea to do all the updating on a separate branch?

apopiak commented 4 years ago

@JoshOrndorff I compiled it with v1.0.

JoshOrndorff commented 4 years ago

Oh great. I didn't realize DispatchResult would work there. Glad to hear it still works.

apopiak commented 4 years ago

It does rely on a renaming import (use support::dispatch::Result as DispatchResult) which I'm happy to make explicit in the snippet. This is necessary because the adder function needs a different Result type.

shawntabrizi commented 4 years ago

@apopiak it might be better just to explicitly return Result<(), &'static str> which relies on no renaming or imports.