Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp committed Apr 29, 2024
1 parent c421f0f commit fd8d60a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bindings/encoding/custom_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
type BlockHashContractCallerAndTransactionReader interface {
bind.BlockHashContractCaller
ethereum.TransactionReader
HeaderByHash(context.Context, common.Hash) (*types.Header, error)
}

// TryParsingCustomErrorFromReceipt tries to parse the custom error from the given receipt.
Expand All @@ -24,6 +25,11 @@ func TryParsingCustomErrorFromReceipt(
from common.Address,
receipt *types.Receipt,
) error {
// get header
header, err := rpc.HeaderByHash(ctx, receipt.BlockHash)
if err != nil {
return err
}
// Fetch the raw transaction.
tx, _, err := rpc.TransactionByHash(ctx, receipt.TxHash)
if err != nil {
Expand All @@ -42,7 +48,7 @@ func TryParsingCustomErrorFromReceipt(
AccessList: tx.AccessList(),
BlobGasFeeCap: tx.BlobGasFeeCap(),
BlobHashes: tx.BlobHashes(),
}, receipt.BlockHash)
}, header.ParentHash)

return TryParsingCustomError(err)
}
Expand Down

0 comments on commit fd8d60a

Please sign in to comment.