L1 function reference
cancelL1ToL2Message
Description
Cancels an L1 to L2 message. Call this function after calling thestartL1ToL2MessageCancellation function. The time between the calls to these two functions must be at least the number of seconds defined by the messageCancellationDelay function.
Only a sender can cancel a message.
If the message is missing, the call reverts.
Be aware that the message fee is not refunded.
State Mutability
None.Parameters
Returns
Emitted event
MessageToL2Canceled
Function definition
Contract:StarknetMessaging.sol
- Function:
cancelL1ToL2Message
consumeMessageFromL2
Description
Consumes a message that was sent from an L2 contract. Returns the hash of the message.State Mutability
None.Parameters
Returns
Emitted event
ConsumedMessageToL1
Function definition
Contract:StarknetMessaging.sol
- Function:
consumeMessageFromL2
getMaxL1MsgFee
Description
Returns the maximum fee, in Wei, that Starknet accepts for a single message. If the fee passed is higher than this value, the transaction is not accepted.State Mutability
pure
Parameters
None.Returns
Function definition
Contract:StarknetMessaging.sol
- Function:
getMaxL1MsgFee
l1ToL2MessageCancellations
Description
Returns the timestamp of the cancellation request.State Mutability
view
Parameters
Returns
Returns
0 if cancelL1ToL2Message was not called with the message hash msgHash.
Function definition
Contract:StarknetMessaging.sol
- Function:
l1ToL2MessageCancellations
l1ToL2MessageNonce
Description
Returns the nonce of the next message sent to the L2 contract. So if Ifn messages have been sent to Starknet, this function returns n + 1.
State Mutability
view
Parameters
None.Returns
Function definition
Contract:StarknetMessaging.sol
- Function:
l1ToL2MessageNonce
l1ToL2Messages
Description
Indicates if a pending message is associated with a given message hash.State Mutability
view
Parameters
Returns
Returnsuint256 result, where result is one of the following:
Function definition
Contract:StarknetMessaging.sol
- Function:
l1ToL2Messages
l2ToL1Messages
Description
Indicates the number of pending messages associated with a given message hash.State Mutability
view
Parameters
Returns
Returnsuint256 result, where result is the number of pending messages associated with the msgHash parameter.
Function definition
Contract:StarknetMessaging.sol
- Function:
l2ToL1Messages
messageCancellationDelay
Description
Returns the time interval, in seconds, after which you can cancel a message starting from the moment of calling thestartL1ToL2MessageCancellation function. You can get the real value by calling the messageCancellationDelay function on a block explorer, such as Etherscan.
State Mutability
view
Parameters
None.Returns
Function definition
Contract:StarknetMessaging.sol
- Function:
messageCancellationDelay
sendMessageToL2
Description
Sends a message to an L2 contract. The message fee is the cost of executing this function.State Mutability
payable
Parameters
Returns
Emitted event
LogMessageToL2
Function definition
Contract:StarknetMessaging.sol
- Function:
sendMessageToL2
startL1ToL2MessageCancellation
Description
Starts the cancellation of a message from L1 to L2. You can cancel a message after a predefined about of time from the moment this function is called. The amount of time is set by themessageCancellationDelay function.
You can only call this function for a message that is currently pending, and the caller must be the sender of that message.
State Mutability
None.Parameters
Returns
Emitted event
MessageToL2CancellationStarted
Function definition
Contract:StarknetMessaging.sol
- Function:
startL1ToL2MessageCancellation
L1 event reference
Events are listed in alphabetical order.ConsumedMessageToL1
Description
This event is emitted when a message from L2 to L1 is consumed by theconsumeMessageFromL2 function.
Event attributes
Event definition
-
Contract:
IStarknetMessagingEvents -
Event:
ConsumedMessageToL1
LogMessageToL2
Description
This event is emitted when a message is sent from L1 to L2 by thesendMessageToL2 function.
Event attributes
Event definition
-
Contract:
IStarknetMessagingEvents -
Event:
LogMessageToL2
MessageToL2Canceled
Description
This event is emitted when an L1 to L2 message is canceled by thecancelL1ToL2Message function.
Event attributes
Event definition
-
Contract:
IStarknetMessagingEvents -
Event:
MessageToL2Canceled
MessageToL2CancellationStarted
Description
This event is emitted when the cancellation of an L1 to L2 message is started by thestartL1ToL2MessageCancellation function.
Event attributes
Event definition
-
Contract:
IStarknetMessagingEvents -
Event:
MessageToL2CancellationStarted