Skip to content

Subscribe to pending transactions with from/toAddress does not work anymore #448

@peterpeterparker

Description

@peterpeterparker

Environment

  • Alchemy SDK version: I tested version 3.1.2, 3.2.1 and 3.3.1

Describe the problem

Subscribing to pending transactions via WebSocket functions properly unless address filtering is applied. When filtering is enabled, pending transactions are no longer emitted.

However, based on my tests, mined transactions continue to work seamlessly in both scenarios, as does subscribing to only transaction hashes.

Relevant code or sample repro:

import { Alchemy, Network, AlchemySubscription } from "alchemy-sdk";

const settings = {
  apiKey: "<-- ALCHEMY APP API KEY -->",
  network: Network.ETH_SEPOLIA,
};

const alchemy = new Alchemy(settings);

const fromAddress ="0x5faB5f7b279bA540Bd54e7A0c46953a61ad5c82b";
const toAddress = "0xAac7A0776a215249dcAB1975a005e17652E2Ef66";

// Ok
alchemy.ws.on(
  {
    method: AlchemySubscription.PENDING_TRANSACTIONS,
  },
  (tx) => console.log(tx)
);

// Ok
alchemy.ws.on(
  {
    method: AlchemySubscription.PENDING_TRANSACTIONS,
    hashesOnly: true
  },
  (tx) => console.log(tx)
);

// Ok
provider.ws.on(
  {
    method: AlchemySubscription.MINED_TRANSACTIONS,
    addresses: [{to: toAddress}]
  },
  (tx) => console.log(tx)
);

// NOT OK
alchemy.ws.on(
  {
    method: AlchemySubscription.PENDING_TRANSACTIONS,
    toAddress,
  },
  (tx) => console.log(tx)
);


// NOT OK
alchemy.ws.on(
  {
    method: AlchemySubscription.PENDING_TRANSACTIONS,
    fromAddress,
  },
  (tx) => console.log(tx)
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions