Skip to main content

SyncingSubscription

subscribe('syncing')

Subscribe to syncing events. This will return true when the node is syncing and when it’s finished syncing will return false, for the changed event.

@example
(await web3.eth.subscribe('syncing')).on('changed', console.log);
> `true` // when syncing

(await web3.eth.subscribe('syncing')).on('data', console.log);
> {
startingBlock: 0,
currentBlock: 0,
highestBlock: 0,
pulledStates: 0,
knownStates: 0
}

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

public_processSubscriptionResult

  • _processSubscriptionResult(data: boolean | { status: SyncOutput; syncing: boolean }): void
  • Parameters

    Returns void

emit

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

    Parameters

    • eventName: K
    • params: { changed: boolean; data: SyncOutput } & CommonSubscriptionEvents[K]

    Returns void

eventNames

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

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

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

    Parameters

    • eventName: K

    Returns number

listeners

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

    Parameters

    • eventName: K

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

off

  • Type parameters

    Parameters

    Returns void

on

  • Type parameters

    Parameters

    Returns void

once

  • Type parameters

    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>