add alloy signers-local, fix simulation-mode

This commit is contained in:
dr-frmr 2024-06-17 23:54:27 -04:00
parent b7b1ac4c38
commit f1d7008523
No known key found for this signature in database
3 changed files with 22 additions and 4 deletions

17
Cargo.lock generated
View File

@ -109,6 +109,7 @@ dependencies = [
"alloy-rpc-types 0.1.1", "alloy-rpc-types 0.1.1",
"alloy-serde 0.1.1", "alloy-serde 0.1.1",
"alloy-signer", "alloy-signer",
"alloy-signer-local",
"alloy-transport 0.1.1", "alloy-transport 0.1.1",
"alloy-transport-http", "alloy-transport-http",
"alloy-transport-ws", "alloy-transport-ws",
@ -511,6 +512,22 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "alloy-sol-macro" name = "alloy-sol-macro"
version = "0.7.6" version = "0.7.6"

View File

@ -39,6 +39,7 @@ alloy = { version = "0.1.1", features = [
"rpc-types", "rpc-types",
"rpc-types-eth", "rpc-types-eth",
"signers", "signers",
"signer-local",
] } ] }
alloy-primitives = "0.7.5" alloy-primitives = "0.7.5"
alloy-sol-macro = "0.7.5" alloy-sol-macro = "0.7.5"

View File

@ -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::providers::{Provider, ProviderBuilder, RootProvider};
use alloy::pubsub::PubSubFrontend; use alloy::pubsub::PubSubFrontend;
use alloy::rpc::client::WsConnect; use alloy::rpc::client::WsConnect;
use alloy::rpc::types::eth::{TransactionInput, TransactionRequest}; 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_primitives::{Address, Bytes, FixedBytes, B256, U256};
use alloy_sol_types::{SolCall, SolValue}; use alloy_sol_types::{SolCall, SolValue};
use lib::core::{Identity, NodeRouting}; use lib::core::{Identity, NodeRouting};
@ -26,13 +26,13 @@ pub async fn register_local(
pubkey: &str, pubkey: &str,
fakechain_port: u16, fakechain_port: u16,
) -> Result<(), anyhow::Error> { ) -> Result<(), anyhow::Error> {
let wallet = LocalWallet::from_str( let wallet = PrivateKeySigner::from_str(
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
)?; )?;
let wallet_address = wallet.address(); let wallet_address = wallet.address();
let signer: EthereumSigner = wallet.into(); let signer: EthereumWallet = wallet.into();
let dotdev = Address::from_str(FAKE_DOTDEV)?; let dotdev = Address::from_str(FAKE_DOTDEV)?;
let kns = Address::from_str(KNS_ADDRESS)?; let kns = Address::from_str(KNS_ADDRESS)?;