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

    • data: boolean | { status: SyncOutput; syncing: boolean }

    Returns void

emit

eventNames

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

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

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

listeners

  • listeners<K>(eventName: K): Function[]

off

on

once

processSubscriptionData

removeAllListeners

  • removeAllListeners(): EventEmitter
  • 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>