From 16be43f3c0f1f670c6f6d50744aa0311b829be42 Mon Sep 17 00:00:00 2001 From: Rian Hughes Date: Wed, 25 Oct 2023 06:27:07 +0100 Subject: [PATCH] rpcv05 update function invocation type (#430) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * rpcv05 update function invocation type * update L1Messages property type --------- Co-authored-by: Carmen Cabrera Co-authored-by: Carmen Irene Cabrera Rodríguez <49727740+cicr99@users.noreply.github.com> --- rpc/types_event.go | 6 ++++++ rpc/types_trace.go | 16 ++++++++-------- rpc/types_transaction_receipt.go | 6 ++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/rpc/types_event.go b/rpc/types_event.go index a8998e2e..04285ae6 100644 --- a/rpc/types_event.go +++ b/rpc/types_event.go @@ -2,6 +2,12 @@ package rpc import "github.com/NethermindEth/juno/core/felt" +type OrderedEvent struct { + // The order of the event within the transaction + Order int `json:"order"` + Event Event +} + type Event struct { FromAddress *felt.Felt `json:"from_address"` Keys []*felt.Felt `json:"keys"` diff --git a/rpc/types_trace.go b/rpc/types_trace.go index 9520a56d..17447c69 100644 --- a/rpc/types_trace.go +++ b/rpc/types_trace.go @@ -80,26 +80,26 @@ type FnInvocation struct { FunctionCall //The address of the invoking contract. 0 for the root invocation - CallerAddress *felt.Felt `json:"caller_address,omitempty"` + CallerAddress *felt.Felt `json:"caller_address"` // The hash of the class being called - ClassHash *felt.Felt `json:"class_hash,omitempty"` + ClassHash *felt.Felt `json:"class_hash"` - EntryPointType EntryPointType `json:"entry_point_type,omitempty"` + EntryPointType EntryPointType `json:"entry_point_type"` - CallType CallType `json:"call_type,omitempty"` + CallType CallType `json:"call_type"` //The value returned from the function invocation - Result []*felt.Felt `json:"result,omitempty"` + Result []*felt.Felt `json:"result"` // The calls made by this invocation - NestedCalls []FnInvocation `json:"calls,omitempty"` + NestedCalls []FnInvocation `json:"calls"` // The events emitted in this invocation - InvocationEvents []Event `json:"events,omitempty"` + InvocationEvents []OrderedEvent `json:"events"` // The messages sent by this invocation to L1 - L1Messages []MsgToL1 `json:"messages,omitempty"` + L1Messages []OrderedMsg `json:"messages"` } // A single pair of transaction hash and corresponding trace diff --git a/rpc/types_transaction_receipt.go b/rpc/types_transaction_receipt.go index 85a9d198..43e1b2d3 100644 --- a/rpc/types_transaction_receipt.go +++ b/rpc/types_transaction_receipt.go @@ -240,6 +240,12 @@ type TransactionReceipt interface { GetExecutionStatus() TxnExecutionStatus } +type OrderedMsg struct { + // The order of the message within the transaction + Order int `json:"order"` + MsgToL1 MsgToL1 +} + type MsgToL1 struct { // FromAddress The address of the L2 contract sending the message FromAddress *felt.Felt `json:"from_address"`