LogsSubscription
Hierarchy
- Web3Subscription<{ data: LogsOutput }, { address?: Address | Address[]; fromBlock?: BlockNumberOrTag; topics?: Topic[] }>
- LogsSubscription
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Parameters
args: { address?: string | string[]; fromBlock?: BlockNumberOrTag; topics?: string[] }
optionalreadonlyaddress: string | string[]
optionalreadonlyfromBlock: BlockNumberOrTag
optionalreadonlytopics: string[]
options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<unknown, {}> }
optionalreturnFormat: DataFormat
subscriptionManager: Web3SubscriptionManager<unknown, {}>
Returns LogsSubscription
Properties
readonlyargs
Type declaration
optionalreadonlyaddress?: string | string[]
optionalreadonlyfromBlock?: BlockNumberOrTag
optionalreadonlytopics?: string[]
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: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
params: { data: LogsOutput } & CommonSubscriptionEvents[K]
Returns void
eventNames
Returns (string | symbol)[]
getMaxListeners
Returns number
listenerCount
Type parameters
- K: Web3EventKey<{ data: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
Returns number
listeners
Type parameters
- K: Web3EventKey<{ data: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
Returns (...args: any[]) => void[]
off
Type parameters
- K: Web3EventKey<{ data: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: LogsOutput } & CommonSubscriptionEvents[K]>
Returns void
on
Type parameters
- K: Web3EventKey<{ data: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: LogsOutput } & CommonSubscriptionEvents[K]>
Returns void
once
Type parameters
- K: Web3EventKey<{ data: LogsOutput } & CommonSubscriptionEvents>
Parameters
eventName: K
fn: Web3EventCallback<{ data: LogsOutput } & 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('logs')
Subscribes to incoming logs, filtered by the given options. If a valid numerical fromBlock options property is set, web3.js will retrieve logs beginning from this point, backfilling the response as necessary.
You can subscribe to logs matching a given filter object, which can take the following parameters:
fromBlock
: (optional, default: 'latest') Integer block number, or'latest'
for the last mined block or'pending'
,'earliest'
for not yet mined transactions.address
: (optional) Contract address or a list of addresses from which logs should originate.topics
: (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA withor
options.