From d1d0fe6c2f4e7a36ae3fcada0d399c0295e6476b Mon Sep 17 00:00:00 2001 From: Francesco Ceccon Date: Mon, 17 Jun 2024 13:38:37 +0200 Subject: [PATCH] starknet: add message definitions --- packages/starknet/src/block.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/starknet/src/block.ts b/packages/starknet/src/block.ts index a3267ea..776a8c7 100644 --- a/packages/starknet/src/block.ts +++ b/packages/starknet/src/block.ts @@ -431,13 +431,36 @@ export const Event = Schema.Struct({ export type Event = typeof Event.Type; +/** A message from the L2 to the L1. + * + * @prop fromAddress The address on L2 that sent the message. + * @prop toAddress The address on L1 that will receive the message. + * @prop payload The message payload. + * @prop messageIndex The message index in the block. + * @prop transactionIndex The transaction index in the block. + * @prop transactionHash The transaction hash. + * @prop transactionReverted Whether the transaction was reverted. + */ export const MessageToL1 = Schema.Struct({ + fromAddress: Schema.optional(FieldElement), toAddress: Schema.optional(FieldElement), + payload: Schema.optional(Schema.Array(FieldElement)), messageIndex: Schema.optional(Schema.Number), + transactionIndex: Schema.optional(Schema.Number), + transactionHash: Schema.optional(FieldElement), + transactionReverted: Schema.optional(Schema.Boolean), }); export type MessageToL1 = typeof MessageToL1.Type; +/** A block. + * + * @prop header The block header. + * @prop transactions The transactions in the block. + * @prop receipts The receipts of the transactions. + * @prop events The events emitted by the transactions. + * @prop messages The messages sent to L1 by the transactions. + */ export const Block = Schema.Struct({ header: Schema.optional(BlockHeader), transactions: Schema.Array(Transaction),