gakonst / ethers-rs

Complete Ethereum & Celo library and wallet implementation in Rust. https://docs.rs/ethers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

subscribe_full_pending_txs seems not working

Malefaro opened this issue · comments

Version

❯ > cargo tree | grep ethers
├── ethers v2.0.13
│   ├── ethers-addressbook v2.0.13
│   │   ├── ethers-core v2.0.13
│   ├── ethers-contract v2.0.13
│   │   ├── ethers-contract-abigen v2.0.13
│   │   │   ├── ethers-core v2.0.13 (*)
│   │   ├── ethers-contract-derive v2.0.13 (proc-macro)
│   │   │   ├── ethers-contract-abigen v2.0.13
│   │   │   │   ├── ethers-core v2.0.13 (*)
│   │   │   ├── ethers-core v2.0.13 (*)
│   │   ├── ethers-core v2.0.13 (*)
│   │   ├── ethers-providers v2.0.13
│   │   │   ├── ethers-core v2.0.13 (*)
│   ├── ethers-core v2.0.13 (*)
│   ├── ethers-etherscan v2.0.13
│   │   ├── ethers-core v2.0.13 (*)
│   ├── ethers-middleware v2.0.13
│   │   ├── ethers-contract v2.0.13 (*)
│   │   ├── ethers-core v2.0.13 (*)
│   │   ├── ethers-etherscan v2.0.13 (*)
│   │   ├── ethers-providers v2.0.13 (*)
│   │   ├── ethers-signers v2.0.13
│   │   │   ├── ethers-core v2.0.13 (*)
│   ├── ethers-providers v2.0.13 (*)
│   └── ethers-signers v2.0.13 (*)

Platform
Linux mech 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Description
I am trying to get full pending transaction using subscribe_full_pending_txs. But stream does not return anything.
subscribe_pending_txs works well but I don't want manually call get_transaction for each pending transaction.
I tried alchemy and infura

I tried this code:

use ethers::prelude::*;
use tracing::{info, Level};

#[tokio::main]
async fn main() {
    tracing_subscriber::fmt().with_max_level(Level::INFO).init();
    let url = std::env::var("WS_URL").unwrap();
    let client = Provider::<Ws>::connect(url).await.unwrap();
    let mut stream = client.subscribe_full_pending_txs().await.unwrap();
    loop {
        let Some(tx) = stream.next().await else {
            break;
        };
        info!(?tx, "tx received");
    }
}

I expected to see this happen:
Receive Transaction objects from stream returned from subscribe_full_pending_txs

Instead, this happened:
After setup tracing I see logs like that:

2024-02-15T10:12:58.469775Z ERROR ethers_providers::rpc::pubsub: failed to deserialize item Error("invalid type: string \"0x3f3bfd5ae30af8aed41dea94e461e1f319254958b4742cc721b2c82dff21a4be\", expected struct Transaction", line: 1, column: 68)

And does not receive anything from this stream.

it's possible that the server just ignores the additional bool, which provider are you using?

it's possible that the server just ignores the additional bool, which provider are you using?

I tried alchemy and infura