Closed
Description
🌟 Feature Request
📝 Description
Alloy is the replacement for ethers.rs - and we should make sure that it is nicely integrated with era-test-node.
Make sure that we expose the rich wallets, and that transactions confirmations work correctly.
Rationale
We had reports that code below doesn't work well:
sol!(
#[sol(rpc)]
Counter,
"out/Counter.sol/Counter.json"
);
async fn call_contract(rpc_url: &str, wallet_pk: &str, contract_addr: &str) -> Result<()> {
// We assume that anvil/era-test-node are running externally and we've deployed the contract there.
let wallet = EthereumWallet::new(PrivateKeySigner::from_str(wallet_pk)?);
let provider = ProviderBuilder::new()
.with_recommended_fillers()
.wallet(wallet)
.on_http(rpc_url.parse()?);
let counter = Counter::new(contract_addr.parse()?, provider);
let tx_hash = counter
.setNumber(U256::from(42))
.send()
.await?
.watch()
.await?;
println!("Tx hash is {tx_hash}");
let number = counter.number().call().await?._0.to_string();
println!("Number is {number}");
Ok(())
}
Activity