Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCCTXErrorJSONMessage ¶
NewCCTXErrorJSONMessage creates a new CCTXErrorMessage struct and returns it as a JSON string. The error field can be of the following types 1 - Nil : If the error is nil, we don't need to do anything 2 - ErrorString : If the error is a string, we add the error and Pack it into a CCTXErrorMessage struct 3 - CCTXErrorMessage : If the error is already a CCTXErrorMessage, we should unpack it and return the JSON string, 4 - If it the error is a chain of errors, we should unpack each error and add it to the CCTXErrorMessage struct error field 5 - If the error is a chain of errors and one of the errors is a CCTXErrorMessage, we should unpack the CCTXErrorMessage and return the JSON string and add the errors into the error field This function does not return an error, if the marshalling fails, it returns a string representation of the CCTXErrorMessage
func SplitErrorMessage ¶
2. "errorString1:{jsonObject}" : deposit error: {"message":"contract call failed when calling EVM with data","error":"execution reverted: ret 0x: evm transaction execution failed", "method":"depositAndCall0","contract":"0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9, args: "[{[] 0xdFb74337c53141bf912101b0Ee770FA8e2DCB921 1337} 0x13A0c5930C028511Dc02665E7285134B6d11A5f4 10000000000000000 0xE83192f6301d090EFB2F38824A12E98877F66fe3 [101 53 52 55 51 50 100 55 50 55 57 99 56 97 99 100 48 97 97 101 55 57 98 51 101 100 99 101 50 55 99 99 50 57 97 49 48 51 56 100 48 102 102 54 52 57 98 53 101 51 56 101 55 51 53 56 55 101 100 55 56 102 49 48 101 101 97 49 52 56 100 97 55 97 51 97 57 100 98 49 101 101 98 55 51 57 100 49 52 54 53 56 55 99 101 99 48 56 54 55]]","revert_reason":""}
Types ¶
type CCTXErrorMessage ¶
type CCTXErrorMessage struct { Type Type `json:"type,omitempty"` Message string `json:"message,omitempty"` Error string `json:"error,omitempty"` Method string `json:"method,omitempty"` Contract string `json:"contract,omitempty"` Args string `json:"args,omitempty"` RevertReason string `json:"revert_reason,omitempty"` }
Zevm specific fields. These fields are only available if the outbound or revert was involved in a ZEVM transaction, as a deposit Contract: Contract called Args: Arguments provided to the call Method: Contract method RevertReason: Reason for the revert if available
func NewCCTXErrorMessage ¶
func NewCCTXErrorMessage(message string) CCTXErrorMessage
NewCCTXErrorMessage creates a new CCTXErrorMessage struct
func NewZEVMErrorMessage ¶
func NewZEVMErrorMessage( method string, contract common.Address, args interface{}, message string, err error, ) CCTXErrorMessage
NewZEVMErrorMessage is s special case of NewCCTXErrorMessage which is called by ZEVM specific code. This creates a CCTXErrorMessage with ZEVM specific fields like Method, Contract, Args
func ParseCCTXErrorMessage ¶
func ParseCCTXErrorMessage(jsonData string) (CCTXErrorMessage, error)
ParseCCTXErrorMessage parses a JSON string into an CCTXErrorMessage struct
func (*CCTXErrorMessage) AddRevertReason ¶
func (e *CCTXErrorMessage) AddRevertReason(revertReason interface{})
AddRevertReason adds a revert reason to the CCTXErrorMessage struct
func (*CCTXErrorMessage) String ¶
func (e *CCTXErrorMessage) String() string
String returns a string representation of an CCTXErrorMessage struct
func (*CCTXErrorMessage) ToJSON ¶
func (e *CCTXErrorMessage) ToJSON() (string, error)
ToJSON marshals an CCTXErrorMessage struct into a JSON string
func (*CCTXErrorMessage) WrapError ¶
func (e *CCTXErrorMessage) WrapError(newError string)
WrapError adds a new error to the CCTXErrorMessage struct