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
linking better to existing docs/tutorials #42
Conversation
I like the direction here, but generally I feel that the structure may continue to change as it is influenced by needs of the top level documentation. It is hard to say exactly what that will look like, but I hope we can continue to be flexible here with the structure. I would expect it to look more like the new table of contents for development, but we shouldnt jump to this conclusion until our docs are done and actually written in this layout:
Furthermore, I hope that you are influencing your decisions with similar projects like "Rust by Example": https://doc.rust-lang.org/rust-by-example/ One this I like about it which is not explicit in your recipes, is that it starts with a "hello world" app. For us I think it is the following: use support::{decl_module, decl_event, decl_storage, StorageValue, StorageMap};
use system::ensure_signed;
pub trait Trait: system::Trait {
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
}
decl_event!{
pub enum Event<T> where
AccountId = <T as system::Trait>::AccountId,
{
ValueSet(AccountId, u64),
}
}
decl_storage! {
trait Store for Module<T: Trait> as Example {
pub LastValue get(last_value): u64;
pub UserValue get(user_value): map T::AccountId => u64;
}
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn deposit_event() = default;
pub fn set_value(origin, value: u64) {
let sender = ensure_signed(origin)?;
LastValue::put(value);
UserValue::<T>::insert(&sender, value);
Self::deposit_event(RawEvent::ValueSet(sender, value));
}
}
} |
I would also like to understand the scope of more heavy examples here. It seems like quite a huge item, and not very generic. |
@shawntabrizi The social network is just a catchy title for what I intended to include snippets from Steve's Hyperledger Grid example. This also fits in with internal work on DIDs, which will have APIs heavily influenced by the invocation of identity and relationships in a similar context. I maybe have overshot for the scope, but the intent is to map the heavy examples as extensions to existing docs using useful features. This is similar to how Rust by Example show minimal examples for interesting crates/apis. Before, the context for the examples weren't clear because they didn't fit within a specific narrative that maps to our other docs. By formatting the heavy examples as minimal extensions for the existing tutorials/samples, I hope to strengthen the link between the official docs/tutorials/samples and the recipes. I do not want the scope of recipes to extend beyond module development and runtime configuration. I cannot maintain this by myself if the scope broadens. |
I don't think the goal is for you to maintain the recipes on your own forever, but I also dont think the goal is to extend recipes past runtime or module development either (at least in the medium term), so we should be gucci. |
Glad this demonstrates |
Should you merge this and start opening smaller PRs for continued content creation? Or whats the plan? |
Double maps require explicit second hasher
Definitely, I'll clean it up and merge it |
GOAL: Better Integration with Docs and Other Resources
High Demand Recipes Code (kitchen)
after working on actual docs PR
soon
the new table of contents will look like
This new structure splits the recipes into two sections separated by
Runtime Configuration
:(2) is designed to increase the strength of the mapping between existing resources by aligning example content with existing sample code:
tour/treasury
with a more thorough explanation of the context behind scheduling spending and permissioned membership for governance=>
ERC20=>
TCR (update and use Gautam's tutorial)None of these are that complicated to put together because they pull heavily from existing resources.
still to do
treasury
based on feedback=>
open issue for comprehensive treasury overview insubstrate docs
=>
will link between the two (same pattern to followed for democracy)maybe next PR