@@ -159,12 +159,7 @@ func (api *CronosAPI) GetTransactionReceiptsByBlock(blockNrOrHash rpctypes.Block
159
159
return nil , fmt .Errorf ("invalid tx type: %T" , msg )
160
160
}
161
161
162
- txData , err := evmtypes .UnpackTxData (ethMsg .Data )
163
- if err != nil {
164
- api .logger .Error ("failed to unpack tx data" , "error" , err .Error ())
165
- return nil , err
166
- }
167
-
162
+ txData := ethMsg .AsTransaction ()
168
163
parsedTx := parsedTxs .GetTxByMsgIndex (msgIndex )
169
164
170
165
// Get the transaction result from the log
@@ -197,7 +192,7 @@ func (api *CronosAPI) GetTransactionReceiptsByBlock(blockNrOrHash rpctypes.Block
197
192
198
193
// Implementation fields: These fields are added by geth when processing a transaction.
199
194
// They are stored in the chain database.
200
- "transactionHash" : ethMsg .Hash ,
195
+ "transactionHash" : txData .Hash () ,
201
196
"contractAddress" : nil ,
202
197
"gasUsed" : hexutil .Uint64 (parsedTx .GasUsed ),
203
198
@@ -209,21 +204,18 @@ func (api *CronosAPI) GetTransactionReceiptsByBlock(blockNrOrHash rpctypes.Block
209
204
210
205
// sender and receiver (contract or EOA) addreses
211
206
"from" : from ,
212
- "to" : txData .GetTo (),
213
- "type" : hexutil .Uint (ethMsg . AsTransaction () .Type ()),
207
+ "to" : txData .To (),
208
+ "type" : hexutil .Uint (txData .Type ()),
214
209
}
215
210
216
211
// If the to is empty, assume it is a contract creation
217
- if txData .GetTo () == nil {
218
- receipt ["contractAddress" ] = crypto .CreateAddress (from , txData .GetNonce ())
212
+ if txData .To () == nil {
213
+ receipt ["contractAddress" ] = crypto .CreateAddress (from , txData .Nonce ())
219
214
}
220
-
221
- if dynamicTx , ok := txData .(* evmtypes.DynamicFeeTx ); ok {
222
- receipt ["effectiveGasPrice" ] = hexutil .Big (* dynamicTx .EffectiveGasPrice (baseFee ))
215
+ if txData .Type () == ethtypes .DynamicFeeTxType {
216
+ receipt ["effectiveGasPrice" ] = hexutil .Big (* ethMsg .GetEffectiveGasPrice (baseFee ))
223
217
}
224
-
225
218
receipts = append (receipts , receipt )
226
-
227
219
txIndex ++
228
220
}
229
221
cumulativeGasUsed += msgCumulativeGasUsed
0 commit comments