Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

EventStream should be exposed publicly #1086

Closed
jmcph4 opened this issue Mar 28, 2022 · 3 comments · Fixed by #1160
Closed

EventStream should be exposed publicly #1086

jmcph4 opened this issue Mar 28, 2022 · 3 comments · Fixed by #1160
Labels
bug Something isn't working

Comments

@jmcph4
Copy link

jmcph4 commented Mar 28, 2022

Version

$ cargo tree | grep ethers
├── ethers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   ├── ethers-addressbook v0.1.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   ├── ethers-contract v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   ├── ethers-contract-abigen v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-contract-derive v0.6.0 (proc-macro) (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-contract-abigen v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   ├── ethers-etherscan v0.2.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-solc v0.3.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   ├── ethers-middleware v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   ├── ethers-contract v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-etherscan v0.2.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   │   ├── ethers-signers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04)
│   │   │   ├── ethers-core v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   ├── ethers-providers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   ├── ethers-signers v0.6.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
│   └── ethers-solc v0.3.0 (https://github.com/gakonst/ethers-rs#df855b04) (*)
├── ethers-contract v0.6.2
│   ├── ethers-core v0.6.3
│   ├── ethers-providers v0.6.2
│   │   ├── ethers-core v0.6.3 (*)

Platform

$ uname -a
Linux foobar 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux

Description

EventStream is emitted by various functions yet is behind a private module in the ethers_contract crate, stream.

Consider the following snippet:

use ethers_contract::stream::EventStream;

/* ... */

async fn setup_stream_from_pools(
    pools: &Vec<PoolCommitter<SignerMiddleware<Provider<Http>, LocalWallet>>>,
) -> Vec<EventStream> {
    let mut all_streams = vec![];

    for pool in pools {
        all_streams.push(
            pool.event::<CreateCommit>()
                .from_block(BlockNumber::Latest)
                .stream()
        );
    }

    let stream = join_all(all_streams)
        .await
        .iter()
        .map(|x| x.unwrap())
        .collect();
    stream
}
$ cargo build
error[E0603]: module `stream` is private
  --> src/main.rs:12:22
   |
12 | use ethers_contract::stream::EventStream;
   |                      ^^^^^^ private module
   |
note: the module `stream` is defined here
  --> /home/johndoe/.cargo/registry/src/github.com-1ecc6299db9ec823/ethers-contract-0.6.2/src/lib.rs:21:1
   |
21 | mod stream;

Ideally, the EventStream type would be exposed in the top-level ethers-rs prelude.

@jmcph4 jmcph4 added the bug Something isn't working label Mar 28, 2022
@mattsse
Copy link
Collaborator

mattsse commented Mar 28, 2022

we should expose this,
in the meantime you can use impl Stream<...> instead

@inconspicuous99
Copy link
Contributor

bump

@mattsse
Copy link
Collaborator

mattsse commented Apr 21, 2022

bump

made pub in #1160

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants