Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff committed Mar 21, 2024
1 parent f9d3ab2 commit 9dd40d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
22 changes: 17 additions & 5 deletions wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ use clap::Parser;
use jsonrpsee::http_client::HttpClientBuilder;
use parity_scale_codec::{Decode, Encode};
use runtime::{OuterConstraintChecker, OuterVerifier};
use sp_runtime::{generic::{Block, Header}, traits::BlakeTwo256};
use sp_runtime::{
generic::{Block, Header},
traits::BlakeTwo256,
};
use std::path::PathBuf;
use tuxedo_core::{types::{OutputRef, Transaction}, verifier::*, SimpleConstraintChecker};
use tuxedo_core::{
types::{OutputRef, Transaction},
verifier::*,
SimpleConstraintChecker,
};

use sp_core::H256;

Expand Down Expand Up @@ -94,9 +101,14 @@ async fn main() -> anyhow::Result<()> {
let node_genesis_hash = rpc::node_get_block_hash(0, &client)
.await?
.expect("node should be able to return some genesis hash");
let node_genesis_block = rpc::node_get_block::<Block<Header<u32, BlakeTwo256>, Transaction<OuterVerifier, ParachainConstraintChecker<OuterConstraintChecker>>>>(node_genesis_hash, &client)
.await?
.expect("node should be able to return some genesis block");
let node_genesis_block = rpc::node_get_block::<
Block<
Header<u32, BlakeTwo256>,
Transaction<OuterVerifier, ParachainConstraintChecker<OuterConstraintChecker>>,
>,
>(node_genesis_hash, &client)
.await?
.expect("node should be able to return some genesis block");
log::debug!("Node's Genesis block::{:?}", node_genesis_hash);

// Open the local database
Expand Down
10 changes: 7 additions & 3 deletions wallet/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ use crate::strip_0x_prefix;
use anyhow::anyhow;
use jsonrpsee::{core::client::ClientT, http_client::HttpClient, rpc_params};
use parity_scale_codec::{Decode, Encode};
use runtime::{opaque::Block as OpaqueBlock};
use runtime::opaque::Block as OpaqueBlock;
use sp_core::H256;
use sp_runtime::generic::Block;
use tuxedo_core::{
types::{Output, OutputRef, Transaction}, ConstraintChecker, Verifier
types::{Output, OutputRef, Transaction},
ConstraintChecker, Verifier,
};

/// Typed helper to get the Node's block hash at a particular height
Expand All @@ -21,7 +22,10 @@ pub async fn node_get_block_hash(height: u32, client: &HttpClient) -> anyhow::Re
}

/// Typed helper to get the node's full block at a particular hash
pub async fn node_get_block<Block: Decode>(hash: H256, client: &HttpClient) -> anyhow::Result<Option<Block>> {
pub async fn node_get_block<Block: Decode>(
hash: H256,
client: &HttpClient,
) -> anyhow::Result<Option<Block>> {
let s = hex::encode(hash.0);
let params = rpc_params![s];

Expand Down

0 comments on commit 9dd40d1

Please sign in to comment.