fix(contract, signers): cyclic deps (#1730)

* fix(signers): cyclic deps

* fix(contract): cyclic deps

* fix: feature
This commit is contained in:
DaniPopes 2022-09-24 21:41:04 +02:00 committed by GitHub
parent 4ed46089d8
commit 0734fce48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 26 deletions

3
Cargo.lock generated
View File

@ -1238,7 +1238,6 @@ dependencies = [
"ethers-contract-derive",
"ethers-core",
"ethers-derive-eip712",
"ethers-middleware",
"ethers-providers",
"ethers-signers",
"ethers-solc",
@ -1429,7 +1428,7 @@ dependencies = [
"coins-ledger",
"elliptic-curve",
"eth-keystore",
"ethers-contract",
"ethers-contract-derive",
"ethers-core",
"ethers-derive-eip712",
"futures-executor",

View File

@ -26,7 +26,6 @@ futures-util = { version = "^0.3" }
hex = { version = "0.4.3", default-features = false, features = ["std"] }
[dev-dependencies]
ethers-middleware = { version = "^0.17.0", path = "../ethers-middleware" }
ethers-providers = { version = "^0.17.0", path = "../ethers-providers", default-features = false, features = [
"ws"
] }

View File

@ -7,9 +7,7 @@ use ethers_core::{
types::{transaction::eip2718::TypedTransaction, Chain, Eip1559TransactionRequest, U256},
utils::Anvil,
};
use ethers_middleware::SignerMiddleware;
use ethers_providers::{MockProvider, Provider};
use ethers_signers::{LocalWallet, Signer};
use ethers_solc::Solc;
use std::{
convert::{TryFrom, TryInto},
@ -617,11 +615,14 @@ fn can_handle_overloaded_events() {
async fn can_send_struct_param() {
abigen!(StructContract, "./tests/solidity-contracts/StructContract.json");
let server = Anvil::new().spawn();
let wallet: LocalWallet = server.keys()[0].clone().into();
let provider = Provider::try_from(server.endpoint()).unwrap();
let client =
Arc::new(SignerMiddleware::new(provider, wallet.with_chain_id(Chain::AnvilHardhat)));
// launch the network & connect to it
let anvil = Anvil::new().spawn();
let from = anvil.addresses()[0];
let provider = Provider::try_from(anvil.endpoint())
.unwrap()
.with_sender(from)
.interval(std::time::Duration::from_millis(10));
let client = Arc::new(provider);
let contract = StructContract::deploy(client, ()).unwrap().legacy().send().await.unwrap();

View File

@ -13,7 +13,6 @@ mod eth_tests {
utils::{keccak256, Anvil},
};
use ethers_derive_eip712::*;
use ethers_middleware::signer::SignerMiddleware;
use ethers_providers::{Http, Middleware, PendingTransaction, Provider, StreamExt};
use ethers_signers::{LocalWallet, Signer};
use std::{convert::TryFrom, sync::Arc, time::Duration};
@ -747,19 +746,17 @@ mod eth_tests {
// get ABI and bytecode for the DeriveEip712Test contract
let (abi, bytecode) = compile_contract("DeriveEip712Test", "DeriveEip712Test.sol");
// launch anvil
// launch the network & connect to it
let anvil = Anvil::new().spawn();
let from = anvil.addresses()[0];
let provider = Provider::try_from(anvil.endpoint())
.unwrap()
.with_sender(from)
.interval(std::time::Duration::from_millis(10));
let client = Arc::new(provider);
let wallet: LocalWallet = anvil.keys()[0].clone().into();
let provider = Provider::<Http>::try_from(anvil.endpoint())
.expect("failed to instantiate provider from anvil endpoint")
.interval(Duration::from_millis(10u64));
let client =
SignerMiddleware::new_with_provider_chain(provider, wallet.clone()).await.unwrap();
let client = Arc::new(client);
let factory = ContractFactory::new(abi.clone(), bytecode.clone(), client.clone());
let contract = factory

View File

@ -44,10 +44,7 @@ eth-keystore = { version = "0.5.0" }
home = { version = "0.5.3", optional = true }
[dev-dependencies]
ethers-contract = { version = "^0.17.0", path = "../ethers-contract", features = [
"eip712",
"abigen"
] }
ethers-contract-derive = { version = "^0.17.0", path = "../ethers-contract/ethers-contract-derive" }
ethers-derive-eip712 = { version = "^0.17.0", path = "../ethers-core/ethers-derive-eip712" }
serde_json = { version = "1.0.64" }
tracing-subscriber = "0.3.15"

View File

@ -250,7 +250,7 @@ impl LedgerEthereum {
mod tests {
use super::*;
use crate::Signer;
use ethers_contract::EthAbiType;
use ethers_contract_derive::EthAbiType;
use ethers_core::types::{
transaction::eip712::Eip712, Address, TransactionRequest, I256, U256,
};

View File

@ -233,7 +233,7 @@ impl TrezorEthereum {
mod tests {
use super::*;
use crate::Signer;
use ethers_contract::EthAbiType;
use ethers_contract_derive::EthAbiType;
use ethers_core::types::{
transaction::{
eip2930::{AccessList, AccessListItem},