Skip to content

Commit

Permalink
Make more wallet stuff generic. Not sure this is the way...
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshOrndorff committed Mar 21, 2024
1 parent 925a123 commit f9d3ab2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ 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 std::path::PathBuf;
use tuxedo_core::{types::OutputRef, verifier::*, SimpleConstraintChecker};
use tuxedo_core::{types::{OutputRef, Transaction}, verifier::*, SimpleConstraintChecker};

use sp_core::H256;

Expand Down Expand Up @@ -93,7 +94,7 @@ 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(node_genesis_hash, &client)
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);
Expand Down
8 changes: 4 additions & 4 deletions wallet/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ 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, Block};
use runtime::{opaque::Block as OpaqueBlock};
use sp_core::H256;
use sp_runtime::generic::Block;
use tuxedo_core::{
types::{Output, OutputRef},
Verifier,
types::{Output, OutputRef, Transaction}, ConstraintChecker, Verifier
};

/// Typed helper to get the Node's block hash at a particular height
Expand All @@ -21,7 +21,7 @@ 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(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 f9d3ab2

Please sign in to comment.