Skip to content

Commit 2dde0c7

Browse files
author
colinlyguo
committed
support setcode type transactions in TransactionData
1 parent 23bd703 commit 2dde0c7

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

core/types/l2trace.go

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -124,23 +124,24 @@ type StorageWrapper struct {
124124
}
125125

126126
type TransactionData struct {
127-
Type uint8 `json:"type"`
128-
Nonce uint64 `json:"nonce"`
129-
TxHash string `json:"txHash"`
130-
Gas uint64 `json:"gas"`
131-
GasPrice *hexutil.Big `json:"gasPrice"`
132-
GasTipCap *hexutil.Big `json:"gasTipCap"`
133-
GasFeeCap *hexutil.Big `json:"gasFeeCap"`
134-
From common.Address `json:"from"`
135-
To *common.Address `json:"to"`
136-
ChainId *hexutil.Big `json:"chainId"`
137-
Value *hexutil.Big `json:"value"`
138-
Data string `json:"data"`
139-
IsCreate bool `json:"isCreate"`
140-
AccessList AccessList `json:"accessList"`
141-
V *hexutil.Big `json:"v"`
142-
R *hexutil.Big `json:"r"`
143-
S *hexutil.Big `json:"s"`
127+
Type uint8 `json:"type"`
128+
Nonce uint64 `json:"nonce"`
129+
TxHash string `json:"txHash"`
130+
Gas uint64 `json:"gas"`
131+
GasPrice *hexutil.Big `json:"gasPrice"`
132+
GasTipCap *hexutil.Big `json:"gasTipCap"`
133+
GasFeeCap *hexutil.Big `json:"gasFeeCap"`
134+
From common.Address `json:"from"`
135+
To *common.Address `json:"to"`
136+
ChainId *hexutil.Big `json:"chainId"`
137+
Value *hexutil.Big `json:"value"`
138+
Data string `json:"data"`
139+
IsCreate bool `json:"isCreate"`
140+
AccessList AccessList `json:"accessList"`
141+
AuthorizationList []SetCodeAuthorization `json:"authorizationList"`
142+
V *hexutil.Big `json:"v"`
143+
R *hexutil.Big `json:"r"`
144+
S *hexutil.Big `json:"s"`
144145
}
145146

146147
// NewTransactionData returns a transaction that will serialize to the trace
@@ -156,23 +157,24 @@ func NewTransactionData(tx *Transaction, blockNumber, blockTime uint64, config *
156157
}
157158

158159
result := &TransactionData{
159-
Type: tx.Type(),
160-
TxHash: tx.Hash().String(),
161-
Nonce: nonce,
162-
ChainId: (*hexutil.Big)(tx.ChainId()),
163-
From: from,
164-
Gas: tx.Gas(),
165-
GasPrice: (*hexutil.Big)(tx.GasPrice()),
166-
GasTipCap: (*hexutil.Big)(tx.GasTipCap()),
167-
GasFeeCap: (*hexutil.Big)(tx.GasFeeCap()),
168-
To: tx.To(),
169-
Value: (*hexutil.Big)(tx.Value()),
170-
Data: hexutil.Encode(tx.Data()),
171-
IsCreate: tx.To() == nil,
172-
AccessList: tx.AccessList(),
173-
V: (*hexutil.Big)(v),
174-
R: (*hexutil.Big)(r),
175-
S: (*hexutil.Big)(s),
160+
Type: tx.Type(),
161+
TxHash: tx.Hash().String(),
162+
Nonce: nonce,
163+
ChainId: (*hexutil.Big)(tx.ChainId()),
164+
From: from,
165+
Gas: tx.Gas(),
166+
GasPrice: (*hexutil.Big)(tx.GasPrice()),
167+
GasTipCap: (*hexutil.Big)(tx.GasTipCap()),
168+
GasFeeCap: (*hexutil.Big)(tx.GasFeeCap()),
169+
To: tx.To(),
170+
Value: (*hexutil.Big)(tx.Value()),
171+
Data: hexutil.Encode(tx.Data()),
172+
IsCreate: tx.To() == nil,
173+
AccessList: tx.AccessList(),
174+
AuthorizationList: tx.SetCodeAuthorizations(),
175+
V: (*hexutil.Big)(v),
176+
R: (*hexutil.Big)(r),
177+
S: (*hexutil.Big)(s),
176178
}
177179
return result
178180
}

0 commit comments

Comments
 (0)