packageerrutilimport("errors""fmt")typeerrWithDatainterface{ErrorData()interface{}}// TryAddRevertReason attempts to extract the revert reason from geth RPC client errors and adds it to the error message.// This is most useful when attempting to execute gas, as if the transaction reverts this will then show the reason.funcTryAddRevertReason(errerror)error{varerrDataerrWithDataok:=errors.As(err,&errData)ifok{returnfmt.Errorf("%w, reason: %v",err,errData.ErrorData())}else{returnerr}}