Skip to main content

L2ToL1Message

Classes

L2ToL1Message

Base functionality for L2->L1 messages

Extended by

Methods

fromEvent()
static fromEvent<T>(
l1SignerOrProvider: T,
event: L2ToL1TransactionEvent,
l1Provider?: Provider): L2ToL1MessageReaderOrWriter<T>

Instantiates a new L2ToL1MessageWriter or L2ToL1MessageReader object.

Type parameters
Type parameter
T extends SignerOrProvider
Parameters
ParameterTypeDescription
l1SignerOrProviderTSigner or provider to be used for executing or reading the L2-to-L1 message.
eventL2ToL1TransactionEventThe event containing the data of the L2-to-L1 message.
l1Provider?ProviderOptional. Used to override the Provider which is attached to l1SignerOrProvider in case you need more control. This will be a required parameter in a future major version update.
Returns

L2ToL1MessageReaderOrWriter<T>

Source

message/L2ToL1Message.ts:73

getL2ToL1Events()
static getL2ToL1Events(
l2Provider: Provider,
filter: object,
position?: BigNumber,
destination?: string,
hash?: BigNumber,
indexInBatch?: BigNumber): Promise<L2ToL1TransactionEvent & object[]>

Get event logs for L2ToL1 transactions.

Parameters
ParameterTypeDescription
l2ProviderProvider
filterobjectBlock range filter
filter.fromBlockBlockTag-
filter.toBlock?BlockTag-
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<L2ToL1TransactionEvent & object[]>

Any classic and nitro events that match the provided filters.

Source

message/L2ToL1Message.ts:102


L2ToL1MessageReader

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

Extends

Extended by

Methods

getFirstExecutableBlock()
getFirstExecutableBlock(l2Provider: Provider): 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
ParameterTypeDescription
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

Source

message/L2ToL1Message.ts:258

status()
status(l2Provider: Provider): Promise<L2ToL1MessageStatus>

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

Parameters
ParameterType
l2ProviderProvider
Returns

Promise<L2ToL1MessageStatus>

Source

message/L2ToL1Message.ts:226

waitUntilReadyToExecute()
waitUntilReadyToExecute(l2Provider: Provider, retryDelay: number): Promise<CONFIRMED | EXECUTED>

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
ParameterTypeDefault valueDescription
l2ProviderProviderundefined-
retryDelaynumber500
Returns

Promise<CONFIRMED | EXECUTED>

outbox entry status (either executed or confirmed but not pending)

Source

message/L2ToL1Message.ts:239

fromEvent()
static fromEvent<T>(
l1SignerOrProvider: T,
event: L2ToL1TransactionEvent,
l1Provider?: Provider): L2ToL1MessageReaderOrWriter<T>

Instantiates a new L2ToL1MessageWriter or L2ToL1MessageReader object.

Type parameters
Type parameter
T extends SignerOrProvider
Parameters
ParameterTypeDescription
l1SignerOrProviderTSigner or provider to be used for executing or reading the L2-to-L1 message.
eventL2ToL1TransactionEventThe event containing the data of the L2-to-L1 message.
l1Provider?ProviderOptional. Used to override the Provider which is attached to l1SignerOrProvider in case you need more control. This will be a required parameter in a future major version update.
Returns

L2ToL1MessageReaderOrWriter<T>

Inherited from

L2ToL1Message . fromEvent

Source

message/L2ToL1Message.ts:73

getL2ToL1Events()
static getL2ToL1Events(
l2Provider: Provider,
filter: object,
position?: BigNumber,
destination?: string,
hash?: BigNumber,
indexInBatch?: BigNumber): Promise<L2ToL1TransactionEvent & object[]>

Get event logs for L2ToL1 transactions.

Parameters
ParameterTypeDescription
l2ProviderProvider
filterobjectBlock range filter
filter.fromBlockBlockTag-
filter.toBlock?BlockTag-
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<L2ToL1TransactionEvent & object[]>

Any classic and nitro events that match the provided filters.

Inherited from

L2ToL1Message . getL2ToL1Events

Source

message/L2ToL1Message.ts:102


L2ToL1MessageWriter

Provides read and write access for l2-to-l1-messages

Extends

Constructors

new L2ToL1MessageWriter()
new L2ToL1MessageWriter(
l1Signer: Signer,
event: L2ToL1TransactionEvent,
l1Provider?: Provider): L2ToL1MessageWriter

Instantiates a new L2ToL1MessageWriter object.

Parameters
ParameterTypeDescription
l1SignerSignerThe signer to be used for executing the L2-to-L1 message.
eventL2ToL1TransactionEventThe event containing the data of the L2-to-L1 message.
l1Provider?ProviderOptional. Used to override the Provider which is attached to l1Signer in case you need more control. This will be a required parameter in a future major version update.
Returns

L2ToL1MessageWriter

Overrides

L2ToL1MessageReader.constructor

Source

message/L2ToL1Message.ts:281

Methods

execute()
execute(l2Provider: Provider, overrides?: Overrides): Promise<ContractTransaction>

Executes the L2ToL1Message on L1. Will throw an error if the outbox entry has not been created, which happens when the corresponding assertion is confirmed.

Parameters
ParameterType
l2ProviderProvider
overrides?Overrides
Returns

Promise<ContractTransaction>

Source

message/L2ToL1Message.ts:310

getFirstExecutableBlock()
getFirstExecutableBlock(l2Provider: Provider): 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
ParameterTypeDescription
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

Inherited from

L2ToL1MessageReader . getFirstExecutableBlock

Source

message/L2ToL1Message.ts:258

status()
status(l2Provider: Provider): Promise<L2ToL1MessageStatus>

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

Parameters
ParameterType
l2ProviderProvider
Returns

Promise<L2ToL1MessageStatus>

Inherited from

L2ToL1MessageReader . status

Source

message/L2ToL1Message.ts:226

waitUntilReadyToExecute()
waitUntilReadyToExecute(l2Provider: Provider, retryDelay: number): Promise<CONFIRMED | EXECUTED>

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
ParameterTypeDefault valueDescription
l2ProviderProviderundefined-
retryDelaynumber500
Returns

Promise<CONFIRMED | EXECUTED>

outbox entry status (either executed or confirmed but not pending)

Inherited from

L2ToL1MessageReader . waitUntilReadyToExecute

Source

message/L2ToL1Message.ts:239

fromEvent()
static fromEvent<T>(
l1SignerOrProvider: T,
event: L2ToL1TransactionEvent,
l1Provider?: Provider): L2ToL1MessageReaderOrWriter<T>

Instantiates a new L2ToL1MessageWriter or L2ToL1MessageReader object.

Type parameters
Type parameter
T extends SignerOrProvider
Parameters
ParameterTypeDescription
l1SignerOrProviderTSigner or provider to be used for executing or reading the L2-to-L1 message.
eventL2ToL1TransactionEventThe event containing the data of the L2-to-L1 message.
l1Provider?ProviderOptional. Used to override the Provider which is attached to l1SignerOrProvider in case you need more control. This will be a required parameter in a future major version update.
Returns

L2ToL1MessageReaderOrWriter<T>

Inherited from

L2ToL1MessageReader . fromEvent

Source

message/L2ToL1Message.ts:73

getL2ToL1Events()
static getL2ToL1Events(
l2Provider: Provider,
filter: object,
position?: BigNumber,
destination?: string,
hash?: BigNumber,
indexInBatch?: BigNumber): Promise<L2ToL1TransactionEvent & object[]>

Get event logs for L2ToL1 transactions.

Parameters
ParameterTypeDescription
l2ProviderProvider
filterobjectBlock range filter
filter.fromBlockBlockTag-
filter.toBlock?BlockTag-
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<L2ToL1TransactionEvent & object[]>

Any classic and nitro events that match the provided filters.

Inherited from

L2ToL1MessageReader . getL2ToL1Events

Source

message/L2ToL1Message.ts:102

Type Aliases

L2ToL1MessageReaderOrWriter<T>

type L2ToL1MessageReaderOrWriter<T>: T extends Provider ? L2ToL1MessageReader : L2ToL1MessageWriter;

Conditional type for Signer or Provider. If T is of type Provider then L2ToL1MessageReaderOrWriter<T> will be of type L2ToL1MessageReader. If T is of type Signer then L2ToL1MessageReaderOrWriter<T> will be of type L2ToL1MessageWriter.

Type parameters

Type parameter
T extends SignerOrProvider

Source

message/L2ToL1Message.ts:51