@@ -71,8 +71,28 @@ class L2toL1Message:
7171 """
7272
7373 payload : List [int ]
74- l1_address : int
75- l2_address : int
74+ l2_address : int # from_address in spec
75+ l1_address : int # to_address in spec
76+
77+
78+ @dataclass
79+ class ResourcePrice :
80+ """
81+ Dataclass representing prices of L1 gas.
82+ """
83+
84+ price_in_wei : int
85+ price_in_strk : Optional [int ]
86+
87+
88+ @dataclass
89+ class ResourceLimits :
90+ """
91+ Dataclass representing resource limits.
92+ """
93+
94+ max_amount : int
95+ max_price_per_unit : int
7696
7797
7898class TransactionType (Enum ):
@@ -97,7 +117,8 @@ class Transaction(ABC):
97117 # together with the rest of the data, it remains here (but is still Optional just in case as spec says)
98118 hash : Optional [int ]
99119 signature : List [int ]
100- max_fee : int
120+ # Optional for DECLARE_V3 and DEPLOY_ACCOUNT_V3, where there is no `max_fee` field, but `l1_gas`
121+ max_fee : Optional [int ]
101122 version : int
102123
103124 def __post_init__ (self ):
@@ -128,6 +149,7 @@ class DeclareTransaction(Transaction):
128149 sender_address : int
129150 compiled_class_hash : Optional [int ] = None # only in DeclareV2, hence Optional
130151 nonce : Optional [int ] = None
152+ l1_gas : Optional [ResourceLimits ] = None # DECLARE_V3-only field, hence Optional
131153
132154
133155@dataclass
@@ -140,6 +162,9 @@ class DeployTransaction(Transaction):
140162 contract_address_salt : int
141163 constructor_calldata : List [int ]
142164 class_hash : int
165+ l1_gas : Optional [
166+ ResourceLimits
167+ ] = None # DEPLOY_ACCOUNT_V3-only field, hence Optional
143168
144169
145170@dataclass
@@ -201,6 +226,7 @@ class TransactionFinalityStatus(Enum):
201226 ACCEPTED_ON_L1 = "ACCEPTED_ON_L1"
202227
203228
229+ # TODO (#1047): split into PendingTransactionReceipt and TransactionReceipt?
204230@dataclass
205231class TransactionReceipt :
206232 """
@@ -213,7 +239,9 @@ class TransactionReceipt:
213239 events : List [Event ] = field (default_factory = list )
214240 l2_to_l1_messages : List [L2toL1Message ] = field (default_factory = list )
215241
216- execution_status : Optional [TransactionExecutionStatus ] = None
242+ execution_status : Optional [
243+ TransactionExecutionStatus
244+ ] = None # gateway/pending receipt field
217245 finality_status : Optional [TransactionFinalityStatus ] = None
218246 status : Optional [
219247 TransactionStatus
@@ -225,14 +253,19 @@ class TransactionReceipt:
225253 block_number : Optional [int ] = None
226254 block_hash : Optional [int ] = None
227255 actual_fee : int = 0
256+ # TODO (#1047): change that into ExecutionResources class after gateway removal
257+ # (values of course differ for each client)
258+ # TODO (#1179): this field should be required
259+ execution_resources : Optional [dict ] = field (default_factory = dict )
260+
261+ message_hash : Optional [int ] = None # L1_HANDLER_TXN_RECEIPT-only
228262
229263 rejection_reason : Optional [str ] = None
230264 revert_reason : Optional [str ] = None # full_node-only field
231265 revert_error : Optional [str ] = None # gateway-only field
232266
233267 # gateway only
234268 l1_to_l2_consumed_message : Optional [L1toL2Message ] = None
235- execution_resources : Optional [dict ] = field (default_factory = dict )
236269 transaction_index : Optional [int ] = None
237270
238271
@@ -279,13 +312,33 @@ class BlockStatus(Enum):
279312@dataclass
280313class PendingStarknetBlock :
281314 """
282- Dataclass representing pending block on Starknet.
315+ Dataclass representing a pending block on Starknet.
283316 """
284317
285318 transactions : List [Transaction ]
286- timestamp : Optional [int ] = None
287- sequencer_address : Optional [int ] = None
288- parent_hash : Optional [int ] = None
319+ parent_block_hash : int
320+ timestamp : int
321+ sequencer_address : int
322+ # TODO (#1179): this field should be required
323+ l1_gas_price : Optional [ResourcePrice ] = None
324+ # TODO (#1179): this field should be required
325+ starknet_version : Optional [str ] = None
326+
327+
328+ @dataclass
329+ class PendingStarknetBlockWithTxHashes :
330+ """
331+ Dataclass representing a pending block on Starknet containing transaction hashes.
332+ """
333+
334+ transactions : List [int ]
335+ parent_block_hash : int
336+ timestamp : int
337+ sequencer_address : int
338+ # TODO (#1179): this field should be required
339+ l1_gas_price : Optional [ResourcePrice ] = None
340+ # TODO (#1179): this field should be required
341+ starknet_version : Optional [str ] = None
289342
290343
291344@dataclass
@@ -294,11 +347,19 @@ class StarknetBlockCommon:
294347 Dataclass representing a block header.
295348 """
296349
350+ # TODO (#1047): change that into composition (with all the breaking changes it will be a minor thing there)
351+ # pylint: disable=too-many-instance-attributes
352+
297353 block_hash : int
298354 parent_block_hash : int
299355 block_number : int
300356 root : int
301357 timestamp : int
358+ sequencer_address : int
359+ # TODO (#1179): this field should be required
360+ l1_gas_price : Optional [ResourcePrice ]
361+ # TODO (#1179): this field should be required
362+ starknet_version : Optional [str ]
302363
303364
304365@dataclass
@@ -307,11 +368,20 @@ class StarknetBlock(StarknetBlockCommon):
307368 Dataclass representing a block on Starknet.
308369 """
309370
310- sequencer_address : int
311371 status : BlockStatus
312372 transactions : List [Transaction ]
313373
314374
375+ @dataclass
376+ class StarknetBlockWithTxHashes (StarknetBlockCommon ):
377+ """
378+ Dataclass representing a block on Starknet containing transaction hashes.
379+ """
380+
381+ status : BlockStatus
382+ transactions : List [int ]
383+
384+
315385@dataclass
316386class GatewayBlockTransactionReceipt :
317387 # pylint: disable=too-many-instance-attributes
@@ -350,29 +420,6 @@ class GatewayBlock:
350420 starknet_version : Optional [str ] = None
351421
352422
353- @dataclass
354- class StarknetBlockWithTxHashes (StarknetBlockCommon ):
355- """
356- Dataclass representing a block on Starknet containing transaction hashes.
357- """
358-
359- sequencer_address : int
360- status : BlockStatus
361- transactions : List [int ]
362-
363-
364- @dataclass
365- class PendingStarknetBlockWithTxHashes :
366- """
367- Dataclass representing a block on Starknet containing transaction hashes.
368- """
369-
370- transactions : List [int ]
371- parent_block_hash : Optional [int ] = None
372- sequencer_address : Optional [int ] = None
373- timestamp : Optional [int ] = None
374-
375-
376423@dataclass
377424class BlockHashAndNumber :
378425 block_hash : int
@@ -674,9 +721,9 @@ class CasmClass:
674721
675722
676723@dataclass
677- class TransactionStatusResponse :
724+ class GatewayTransactionStatusResponse :
678725 """
679- Dataclass representing transaction status.
726+ Dataclass representing transaction status for the GatewayClient .
680727 """
681728
682729 block_hash : Optional [int ]
@@ -685,6 +732,16 @@ class TransactionStatusResponse:
685732 execution_status : Optional [TransactionExecutionStatus ] = None
686733
687734
735+ @dataclass
736+ class TransactionStatusResponse :
737+ """
738+ Dataclass representing transaction status for the FullNodeClient.
739+ """
740+
741+ finality_status : TransactionStatus
742+ execution_status : Optional [TransactionExecutionStatus ] = None
743+
744+
688745@dataclass
689746class SignatureInput :
690747 """
@@ -706,17 +763,59 @@ class SignatureOnStateDiff:
706763 signature_input : SignatureInput
707764
708765
766+ class DAMode (Enum ):
767+ """
768+ Enum specifying a storage domain in Starknet. Each domain has different gurantess regarding availability.
769+ """
770+
771+ L1 = "L1"
772+ L2 = "L2"
773+
774+
775+ @dataclass
776+ class ExecutionResources :
777+ """
778+ Dataclass representing the resources consumed by the transaction.
779+ """
780+
781+ # pylint: disable=too-many-instance-attributes
782+
783+ # For now the class and schema related to it is unused, it is waiting here for refactoring.
784+ steps : int
785+ range_check_builtin_applications : int
786+ pedersen_builtin_applications : int
787+ poseidon_builtin_applications : int
788+ ec_op_builtin_applications : int
789+ ecdsa_builtin_applications : int
790+ bitwise_builtin_applications : int
791+ keccak_builtin_applications : int
792+ memory_holes : Optional [int ] = None
793+
794+
709795# ------------------------------- Trace API dataclasses -------------------------------
710796
711797
712798@dataclass
713- class EventContent :
799+ class OrderedEvent :
714800 """
715- Dataclass representing contents of an event.
801+ Dataclass representing an event alongside its order within the transaction .
716802 """
717803
718804 keys : List [int ]
719805 data : List [int ]
806+ order : int
807+
808+
809+ @dataclass
810+ class OrderedMessage :
811+ """
812+ Dataclass representing a message alongside its order within the transaction.
813+ """
814+
815+ payload : List [int ]
816+ l2_address : int # from_address in spec
817+ l1_address : int # to_address in spec
818+ order : int
720819
721820
722821class SimulationFlag (str , Enum ):
@@ -763,8 +862,8 @@ class FunctionInvocation:
763862 call_type : CallType
764863 result : List [int ]
765864 calls : List ["FunctionInvocation" ]
766- events : List [Event ]
767- messages : List [L2toL1Message ]
865+ events : List [OrderedEvent ]
866+ messages : List [OrderedMessage ]
768867
769868
770869@dataclass
@@ -782,9 +881,10 @@ class InvokeTransactionTrace:
782881 Dataclass representing a transaction trace of an INVOKE transaction.
783882 """
784883
785- validate_invocation : Optional [ FunctionInvocation ]
884+ validate_invocation : FunctionInvocation
786885 execute_invocation : Union [FunctionInvocation , RevertedFunctionInvocation ]
787- fee_transfer_invocation : Optional [FunctionInvocation ]
886+ fee_transfer_invocation : FunctionInvocation
887+ state_diff : StateDiff
788888
789889
790890@dataclass
@@ -793,8 +893,9 @@ class DeclareTransactionTrace:
793893 Dataclass representing a transaction trace of an DECLARE transaction.
794894 """
795895
796- validate_invocation : Optional [FunctionInvocation ]
797- fee_transfer_invocation : Optional [FunctionInvocation ]
896+ validate_invocation : FunctionInvocation
897+ fee_transfer_invocation : FunctionInvocation
898+ state_diff : StateDiff
798899
799900
800901@dataclass
@@ -803,9 +904,10 @@ class DeployAccountTransactionTrace:
803904 Dataclass representing a transaction trace of an DEPLOY_ACCOUNT transaction.
804905 """
805906
806- validate_invocation : Optional [ FunctionInvocation ]
907+ validate_invocation : FunctionInvocation
807908 constructor_invocation : FunctionInvocation
808- fee_transfer_invocation : Optional [FunctionInvocation ]
909+ fee_transfer_invocation : FunctionInvocation
910+ state_diff : StateDiff
809911
810912
811913@dataclass
0 commit comments