From f1d7008523e6861d22ad2194358457f981ff2499 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 17 Jun 2024 23:54:27 -0400 Subject: [PATCH] add alloy signers-local, fix simulation-mode --- Cargo.lock | 17 +++++++++++++++++ kinode/Cargo.toml | 1 + kinode/src/fakenet/mod.rs | 8 ++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28e5e2dc..f7e70462 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,6 +109,7 @@ dependencies = [ "alloy-rpc-types 0.1.1", "alloy-serde 0.1.1", "alloy-signer", + "alloy-signer-local", "alloy-transport 0.1.1", "alloy-transport-http", "alloy-transport-ws", @@ -511,6 +512,22 @@ dependencies = [ "thiserror", ] +[[package]] +name = "alloy-signer-local" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c44057ac1e8707f8c6a983db9f83ac1265c9e05be81d432acf2aad2880e1c0" +dependencies = [ + "alloy-consensus 0.1.1", + "alloy-network", + "alloy-primitives", + "alloy-signer", + "async-trait", + "k256", + "rand 0.8.5", + "thiserror", +] + [[package]] name = "alloy-sol-macro" version = "0.7.6" diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 0e6c4288..7f2f48a1 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -39,6 +39,7 @@ alloy = { version = "0.1.1", features = [ "rpc-types", "rpc-types-eth", "signers", + "signer-local", ] } alloy-primitives = "0.7.5" alloy-sol-macro = "0.7.5" diff --git a/kinode/src/fakenet/mod.rs b/kinode/src/fakenet/mod.rs index 582e8f44..0a75c81d 100644 --- a/kinode/src/fakenet/mod.rs +++ b/kinode/src/fakenet/mod.rs @@ -1,9 +1,9 @@ -use alloy::network::{eip2718::Encodable2718, EthereumSigner, TransactionBuilder}; +use alloy::network::{eip2718::Encodable2718, EthereumWallet, TransactionBuilder}; use alloy::providers::{Provider, ProviderBuilder, RootProvider}; use alloy::pubsub::PubSubFrontend; use alloy::rpc::client::WsConnect; use alloy::rpc::types::eth::{TransactionInput, TransactionRequest}; -use alloy::signers::wallet::LocalWallet; +use alloy::signers::local::PrivateKeySigner; use alloy_primitives::{Address, Bytes, FixedBytes, B256, U256}; use alloy_sol_types::{SolCall, SolValue}; use lib::core::{Identity, NodeRouting}; @@ -26,13 +26,13 @@ pub async fn register_local( pubkey: &str, fakechain_port: u16, ) -> Result<(), anyhow::Error> { - let wallet = LocalWallet::from_str( + let wallet = PrivateKeySigner::from_str( "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", )?; let wallet_address = wallet.address(); - let signer: EthereumSigner = wallet.into(); + let signer: EthereumWallet = wallet.into(); let dotdev = Address::from_str(FAKE_DOTDEV)?; let kns = Address::from_str(KNS_ADDRESS)?;