mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Make system properties an arbitrary JSON object, plus CI fixes (#349)
* Make system properties an arbitrary JSON object * Add comment * Make timestamp test more reliable * Fmt * Update src/client.rs Co-authored-by: David <dvdplm@gmail.com> * Update src/client.rs Co-authored-by: David <dvdplm@gmail.com> * Fix clippy errors and warnings * Fix tests Co-authored-by: David <dvdplm@gmail.com>
This commit is contained in:
@@ -15,34 +15,12 @@
|
||||
// along with subxt. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::test_context;
|
||||
use std::time::{
|
||||
SystemTime,
|
||||
UNIX_EPOCH,
|
||||
};
|
||||
|
||||
#[async_std::test]
|
||||
async fn storage_get_current_timestamp() {
|
||||
let sys_timestamp = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_millis() as u64;
|
||||
let cxt = test_context().await;
|
||||
|
||||
// wait until blocks are produced to get the timestamp
|
||||
let mut sub = cxt.client().rpc().subscribe_blocks().await.unwrap();
|
||||
let block_hash = loop {
|
||||
if let Ok(Some(block)) = sub.next().await {
|
||||
break block.hash()
|
||||
}
|
||||
};
|
||||
let timestamp = cxt.api.storage().timestamp().now(None).await;
|
||||
|
||||
let timestamp = cxt
|
||||
.api
|
||||
.storage()
|
||||
.timestamp()
|
||||
.now(Some(block_hash))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(timestamp > sys_timestamp)
|
||||
assert!(timestamp.is_ok())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user