From fc5084814ccb7c3204db263840c0266244d8f966 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Thu, 18 Jan 2024 20:28:00 +0800 Subject: [PATCH 1/3] feat: add accessList field in toCallArg --- ethclient/ethclient.go | 10 ++++++++++ ethclient/gethclient/gethclient.go | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 900335988b28..d2bb54492073 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -662,6 +662,16 @@ func toCallArg(msg ethereum.CallMsg) interface{} { if msg.GasTipCap != nil { arg["maxPriorityFeePerGas"] = (*hexutil.Big)(msg.GasTipCap) } + if msg.AccessList != nil { + accessListArg := make([]map[string]interface{}, len(msg.AccessList)) + for i, access := range msg.AccessList { + accessListArg[i] = map[string]interface{}{ + "address": access.Address, + "storageKeys": access.StorageKeys, + } + } + arg["accessList"] = accessListArg + } return arg } diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index e2c0ef3ed02e..37078673ce08 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -236,6 +236,22 @@ func toCallArg(msg ethereum.CallMsg) interface{} { if msg.GasPrice != nil { arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) } + if msg.GasFeeCap != nil { + arg["maxFeePerGas"] = (*hexutil.Big)(msg.GasFeeCap) + } + if msg.GasTipCap != nil { + arg["maxPriorityFeePerGas"] = (*hexutil.Big)(msg.GasTipCap) + } + if msg.AccessList != nil { + accessListArg := make([]map[string]interface{}, len(msg.AccessList)) + for i, access := range msg.AccessList { + accessListArg[i] = map[string]interface{}{ + "address": access.Address, + "storageKeys": access.StorageKeys, + } + } + arg["accessList"] = accessListArg + } return arg } From 51be7fc912571b41aa7a2dfc9886b025288315e3 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 19 Jan 2024 15:33:12 +0100 Subject: [PATCH 2/3] Update ethclient.go --- ethclient/ethclient.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index d2bb54492073..5b4e906cbb01 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -663,14 +663,7 @@ func toCallArg(msg ethereum.CallMsg) interface{} { arg["maxPriorityFeePerGas"] = (*hexutil.Big)(msg.GasTipCap) } if msg.AccessList != nil { - accessListArg := make([]map[string]interface{}, len(msg.AccessList)) - for i, access := range msg.AccessList { - accessListArg[i] = map[string]interface{}{ - "address": access.Address, - "storageKeys": access.StorageKeys, - } - } - arg["accessList"] = accessListArg + arg["accessList"] = msg.AccessList } return arg } From 5a51243f4474b8fc704d60711f4cc443037ab113 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 19 Jan 2024 15:35:14 +0100 Subject: [PATCH 3/3] Update gethclient.go --- ethclient/gethclient/gethclient.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index 37078673ce08..73d05d499efe 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -243,14 +243,7 @@ func toCallArg(msg ethereum.CallMsg) interface{} { arg["maxPriorityFeePerGas"] = (*hexutil.Big)(msg.GasTipCap) } if msg.AccessList != nil { - accessListArg := make([]map[string]interface{}, len(msg.AccessList)) - for i, access := range msg.AccessList { - accessListArg[i] = map[string]interface{}{ - "address": access.Address, - "storageKeys": access.StorageKeys, - } - } - arg["accessList"] = accessListArg + arg["accessList"] = msg.AccessList } return arg }