我正在关注Substrate Kitties研讨会。在1/Viewing a Storage Mapping
中,我无法访问Polkadot UI 选项卡上的kitties
模块:#extrinsics
我尝试多次重新加载它。这是我的kitties.rs
(编译得很好):
use support::{decl_storage, decl_module, StorageMap, dispatch::Result};
use system::ensure_signed;
pub trait Trait: balances::Trait {}
decl_storage! {
trait Store for Module<T: Trait> as KittyStorage {
Value: map T::AccountId => u64;
}
}
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
fn set_value(origin, value: u64) -> Result {
let sender = ensure_signed(origin)?;
<Value<T>>::insert(sender, value);
Ok(())
}
}
}
我在lib.rs
/// Used for the Substrate Kitties in `./kitties.rs`
mod kitties;
[...]
/// Used for the Substrate Kitties in `./kitties.rs`
impl kitties::Trait for Runtime {}
并将其添加到运行时。
construct_runtime!(
pub enum Runtime with Log(InternalLog: DigestItem<Hash, AuthorityId, AuthoritySignature>) where
Block = Block,
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{default, Log(ChangesTrieRoot)},
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
Consensus: consensus::{Module, Call, Storage, Config<T>, Log(AuthoritiesChange), Inherent},
Aura: aura::{Module},
Indices: indices,
Balances: balances,
Sudo: sudo,
Kitties: kitties::{Module, Call, Storage},
// Used for the module template in `./template.rs`
TemplateModule: template::{Module, Call, Storage, Event<T>},
ExampleModule: substrate_module_template::{Module, Call, Storage, Event<T>},
}
);
我错过了什么?向 Substrate 运行时注册我的模块还需要什么?