Skip to main content

Class: L2ToL1MessageReader

message/L2ToL1Message.L2ToL1MessageReader

Provides read-only access for l2-to-l1-messages

Hierarchy

Methods

getFirstExecutableBlock

getFirstExecutableBlock(l2Provider): Promise<null | BigNumber>

Estimates the L1 block number in which this L2 to L1 tx will be available for execution. If the message can or already has been executed, this returns null

Parameters

NameType
l2ProviderProvider

Returns

Promise<null | BigNumber>

expected L1 block number where the L2 to L1 message will be executable. Returns null if the message can or already has been executed

Defined in

src/lib/message/L2ToL1Message.ts:249


status

status(l2Provider): Promise<L2ToL1MessageStatus>

Get the status of this message In order to check if the message has been executed proof info must be provided.

Parameters

NameType
l2ProviderProvider

Returns

Promise<L2ToL1MessageStatus>

Defined in

src/lib/message/L2ToL1Message.ts:217


waitUntilReadyToExecute

waitUntilReadyToExecute(l2Provider, retryDelay?): Promise<void>

Waits until the outbox entry has been created, and will not return until it has been. WARNING: Outbox entries are only created when the corresponding node is confirmed. Which can take 1 week+, so waiting here could be a very long operation.

Parameters

NameTypeDefault value
l2ProviderProviderundefined
retryDelaynumber500

Returns

Promise<void>

Defined in

src/lib/message/L2ToL1Message.ts:230


getL2ToL1Events

Static getL2ToL1Events(l2Provider, filter, position?, destination?, hash?, indexInBatch?): Promise<Object[]>

Get event logs for L2ToL1 transactions.

Parameters

NameTypeDescription
l2ProviderProvider
filterObjectBlock range filter
filter.fromBlockBlockTag-
filter.toBlockBlockTag-
position?BigNumberThe batchnumber indexed field was removed in nitro and a position indexed field was added. For pre-nitro events the value passed in here will be used to find events with the same batchnumber. For post nitro events it will be used to find events with the same position.
destination?stringThe L1 destination of the L2ToL1 message
hash?BigNumberThe uniqueId indexed field was removed in nitro and a hash indexed field was added. For pre-nitro events the value passed in here will be used to find events with the same uniqueId. For post nitro events it will be used to find events with the same hash.
indexInBatch?BigNumberThe index in the batch, only valid for pre-nitro events. This parameter is ignored post-nitro

Returns

Promise<Object[]>

Any classic and nitro events that match the provided filters.

Inherited from

L2ToL1Message.getL2ToL1Events

Defined in

src/lib/message/L2ToL1Message.ts:93