Skip to content

Commit

Permalink
fix: hotfix cast logs subscribe (#7688)
Browse files Browse the repository at this point in the history
* fix: hotfix cast logs subscribe

* fix features
  • Loading branch information
mattsse authored Apr 16, 2024
1 parent 24536cd commit 8513f61
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/anvil/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ alloy-sol-types = { workspace = true, features = ["std"] }
alloy-dyn-abi = { workspace = true, features = ["std", "eip712"] }
alloy-rpc-types.workspace = true
alloy-rpc-types-trace.workspace = true
alloy-provider = { workspace = true, features = ["pubsub"] }
alloy-provider = { workspace = true, features = ["reqwest", "ws", "ipc"] }
alloy-transport.workspace = true
alloy-chains.workspace = true
alloy-genesis.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ alloy-dyn-abi.workspace = true
alloy-json-abi.workspace = true
alloy-primitives.workspace = true
alloy-rlp.workspace = true
alloy-provider = { workspace = true, features = ["pubsub"] }
alloy-provider = { workspace = true, features = ["reqwest", "ws", "ipc"] }
alloy-transport.workspace = true
alloy-rpc-types.workspace = true
alloy-json-rpc.workspace = true
Expand Down
9 changes: 9 additions & 0 deletions crates/cast/bin/cmd/logs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_dyn_abi::{DynSolType, DynSolValue, Specifier};
use alloy_json_abi::Event;
use alloy_network::AnyNetwork;
use alloy_primitives::{Address, B256};
use alloy_rpc_types::{BlockId, BlockNumberOrTag, Filter, FilterBlockOption, FilterSet, Topic};
use cast::Cast;
Expand Down Expand Up @@ -93,6 +94,14 @@ impl LogsArgs {
return Ok(())
}

// FIXME: this is a hotfix for <https://github.com/foundry-rs/foundry/issues/7682>
// currently the alloy `eth_subscribe` impl does not work with all transports, so we use
// the builtin transport here for now
let url = config.get_rpc_url_or_localhost_http()?;
let provider = alloy_provider::ProviderBuilder::<_, _, AnyNetwork>::default()
.on_builtin(url.as_ref())
.await?;
let cast = Cast::new(&provider);
let mut stdout = io::stdout();
cast.subscribe(filter, &mut stdout, json).await?;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ alloy-dyn-abi.workspace = true
alloy-json-abi.workspace = true
alloy-primitives = { workspace = true, features = ["serde"] }
alloy-rpc-types.workspace = true
alloy-provider.workspace = true
alloy-provider = { workspace = true, features = ["reqwest", "ws", "ipc"] }
alloy-network.workspace = true
alloy-transport.workspace = true
alloy-signer.workspace = true
Expand Down

0 comments on commit 8513f61

Please sign in to comment.