NewHeadsSubscription
Hierarchy
- Web3Subscription<{ data: BlockHeaderOutput }>
- NewHeadsSubscription
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Parameters
args: any
options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<unknown, {}> }
optionalreturnFormat: DataFormat
subscriptionManager: Web3SubscriptionManager<unknown, {}>
Returns NewHeadsSubscription
Properties
readonlyargs
Accessors
id
Returns undefined | string
lastBlock
Returns undefined | BlockOutput
Methods
_processSubscriptionError
Parameters
error: Error
Returns void
_processSubscriptionResult
Parameters
data: unknown
Returns void
emit
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
params: { data: BlockHeaderOutput } & CommonSubscriptionEvents[K]
Returns void
eventNames
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: BlockHeaderOutput } & CommonSubscriptionEvents[K]>
Returns void
on
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: BlockHeaderOutput } & CommonSubscriptionEvents[K]>
Returns void
once
Type parameters
- K: Web3EventKey<{ data: BlockHeaderOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: BlockHeaderOutput } & CommonSubscriptionEvents[K]>
Returns void
processSubscriptionData
Parameters
Returns void
removeAllListeners
Returns EventEmitter
resubscribe
Returns Promise<void>
sendSubscriptionRequest
Returns Promise<string>
sendUnsubscribeRequest
Returns Promise<void>
setMaxListenerWarningThreshold
Parameters
maxListenersWarningThreshold: number
Returns void
subscribe
Returns Promise<string>
unsubscribe
Returns Promise<void>
subscribe('newHeads') ( same as subscribe('newBlockHeaders'))
Subscribes to incoming block headers. This can be used as timer to check for changes on the blockchain.
The structure of a returned block header is BlockHeaderOutput: