Fix optional store items. (#120)

* Fix optional store items.

* Support querying a block hash.
This commit is contained in:
David Craven
2020-06-01 13:24:56 +02:00
committed by GitHub
parent a2eead0c3d
commit 26ada75dec
8 changed files with 94 additions and 38 deletions
+5 -5
View File
@@ -330,7 +330,7 @@ impl Step {
};
let build_struct = quote! {
#(
let #state_name = client.fetch(#state, None).await.unwrap();
let #state_name = client.fetch_or_default(#state, None).await.unwrap();
)*
State { #(#state_name),* }
};
@@ -477,11 +477,11 @@ mod tests {
let pre = {
let alice = client
.fetch(AccountStore { account_id: &alice }, None)
.fetch_or_default(AccountStore { account_id: &alice }, None)
.await
.unwrap();
let bob = client
.fetch(AccountStore { account_id: &bob }, None)
.fetch_or_default(AccountStore { account_id: &bob }, None)
.await
.unwrap();
State { alice, bob }
@@ -510,11 +510,11 @@ mod tests {
let post = {
let alice = client
.fetch(AccountStore { account_id: &alice }, None)
.fetch_or_default(AccountStore { account_id: &alice }, None)
.await
.unwrap();
let bob = client
.fetch(AccountStore { account_id: &bob }, None)
.fetch_or_default(AccountStore { account_id: &bob }, None)
.await
.unwrap();
State { alice, bob }