Skip to main content

NewPendingTransactionsSubscription

subscribe('pendingTransactions')

Subscribes to incoming pending transactions.

You can subscribe to pending transactions by calling web3.eth.subscribe('pendingTransactions').

@example
(await web3.eth.subscribe('pendingTransactions')).on('data', console.log);

Hierarchy

Index

Constructors

constructor

Properties

readonlyargs

args: any

Accessors

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

Methods

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: { data: string } & CommonSubscriptionEvents[K]): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • params: { data: string } & CommonSubscriptionEvents[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>