@@ -58,9 +58,7 @@ func (r *Receipt) setNativeReceipt(receipt *types.Receipt) {
5858
5959// This method is duplicated code from: `compressor/contract.go`
6060// can't be used directly, because it would create a circular dependency
61- func DecompressCalldata (ctx context.Context , provider * ethrpc.Provider , transaction * types.Transaction ) (common.Address , []byte , error ) {
62- data := transaction .Data ()
63-
61+ func DecompressCalldata (ctx context.Context , to * common.Address , data []byte , provider * ethrpc.Provider ) (common.Address , []byte , error ) {
6462 if len (data ) == 0 {
6563 return common.Address {}, nil , fmt .Errorf ("empty transaction data" )
6664 }
@@ -75,11 +73,7 @@ func DecompressCalldata(ctx context.Context, provider *ethrpc.Provider, transact
7573 copy (c2 , data )
7674 c2 [0 ] = byte (0x06 )
7775
78- res , err := provider .CallContract (ctx , ethereum.CallMsg {
79- To : transaction .To (),
80- Data : c2 ,
81- }, nil )
82-
76+ res , err := provider .CallContract (ctx , ethereum.CallMsg {To : to , Data : c2 }, nil )
8377 if err != nil {
8478 return common.Address {}, nil , err
8579 }
@@ -103,7 +97,7 @@ func TryDecodeCalldata(
10397 }
10498
10599 // Try decoding it decompressed
106- addr , decompressed , err2 := DecompressCalldata (ctx , provider , transaction )
100+ addr , decompressed , err2 := DecompressCalldata (ctx , transaction . To () , transaction . Data (), provider )
107101 if err2 != nil {
108102 // Don't bubble up the decompression error, as it might not be a decompression error
109103 return common.Address {}, nil , nil , nil , err
0 commit comments