Reorganize serai-client

Instead of functions taking a block hash, has a scope to a block hash before
functions can be called.

Separates functions by pallets.
This commit is contained in:
Luke Parker
2023-10-14 02:47:58 -04:00
parent 96cc5d0157
commit cb61c9052a
13 changed files with 384 additions and 365 deletions

View File

@@ -11,7 +11,7 @@ pub async fn publish_tx(tx: &Encoded) -> [u8; 32] {
let serai = serai().await;
let mut latest =
serai.get_block(serai.get_latest_block_hash().await.unwrap()).await.unwrap().unwrap().number();
serai.block(serai.latest_block_hash().await.unwrap()).await.unwrap().unwrap().number();
serai.publish(tx).await.unwrap();
@@ -24,7 +24,7 @@ pub async fn publish_tx(tx: &Encoded) -> [u8; 32] {
let block = {
let mut block;
while {
block = serai.get_block_by_number(latest).await.unwrap();
block = serai.block_by_number(latest).await.unwrap();
block.is_none()
} {
sleep(Duration::from_secs(1)).await;