Improve dynamic events type sizes API (#61)

* Do not error if type sizes missing: log warn

* Split out EventsSubscriber, allow updating events decoder

* Format code

* Check missing type sizes after registration

* Add example which for submit and watching events
This commit is contained in:
Andrew Jones
2020-01-07 15:14:30 +00:00
committed by GitHub
parent 80663ec6e3
commit b159d0dae1
6 changed files with 130 additions and 57 deletions
+15 -10
View File
@@ -186,7 +186,8 @@ mod tests {
let wasm = wabt::wat2wasm(CONTRACT).expect("invalid wabt");
client.xt(signer, None).and_then(|xt| {
xt.submit_and_watch(super::put_code(500_000, wasm))
xt.watch()
.submit(super::put_code(500_000, wasm))
.map(|result| result.find_event::<T::Hash>(MODULE, events::CODE_STORED))
})
}
@@ -224,15 +225,19 @@ mod tests {
println!("{:?}", code_hash);
let instantiate = client.xt(signer, None).and_then(move |xt| {
xt.submit_and_watch(super::instantiate::<Runtime>(
100_000_000_000_000,
500_000,
code_hash,
Vec::new(),
))
.map(|result| {
result.find_event::<(AccountId, AccountId)>(MODULE, events::INSTANTIATED)
})
xt.watch()
.submit(super::instantiate::<Runtime>(
100_000_000_000_000,
500_000,
code_hash,
Vec::new(),
))
.map(|result| {
result.find_event::<(AccountId, AccountId)>(
MODULE,
events::INSTANTIATED,
)
})
});
let result = rt.block_on(instantiate).unwrap();