From f9d3ab2e8f79f5b1c82e0f609685325153cd0e68 Mon Sep 17 00:00:00 2001 From: Joshy Orndorff Date: Thu, 21 Mar 2024 15:30:29 -0400 Subject: [PATCH] Make more wallet stuff generic. Not sure this is the way... --- wallet/src/main.rs | 5 +++-- wallet/src/rpc.rs | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wallet/src/main.rs b/wallet/src/main.rs index d4bc09b4f..43c423092 100644 --- a/wallet/src/main.rs +++ b/wallet/src/main.rs @@ -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; @@ -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::, Transaction>>>(node_genesis_hash, &client) .await? .expect("node should be able to return some genesis block"); log::debug!("Node's Genesis block::{:?}", node_genesis_hash); diff --git a/wallet/src/rpc.rs b/wallet/src/rpc.rs index 0d5466e6d..fca5a9f14 100644 --- a/wallet/src/rpc.rs +++ b/wallet/src/rpc.rs @@ -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 @@ -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> { +pub async fn node_get_block(hash: H256, client: &HttpClient) -> anyhow::Result> { let s = hex::encode(hash.0); let params = rpc_params![s];