Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeChangeModulesCallData(calldata []string) (map[string]any, error)
- func DecodeEventData(data []string, typ EventItem, structs map[string]*StructItem) (map[string]any, error)
- func DecodeExecuteCallData(calldata []string) (map[string]any, error)
- func DecodeFunctionCallData(calldata []string, typ FunctionItem, structs map[string]*StructItem) (map[string]any, error)
- type Abi
- func (a *Abi) GetByTypeAndSelector(typ string, selector string) (any, bool)
- func (a *Abi) GetConstructorBySelector(selector string) (*FunctionItem, bool)
- func (a *Abi) GetEventBySelector(selector string) (*EventItem, bool)
- func (a *Abi) GetFunctionBySelector(selector string) (*FunctionItem, bool)
- func (a *Abi) GetL1HandlerBySelector(selector string) (*FunctionItem, bool)
- func (a *Abi) GetStructBySelector(selector string) (*StructItem, bool)
- func (a *Abi) UnmarshalJSON(raw []byte) error
- type EventItem
- type FunctionItem
- type Member
- type StructItem
- type Type
Constants ¶
const ( FunctionType = "function" L1HandlerType = "l1_handler" ConstructorType = "constructor" EventType = "event" StructType = "struct" )
abi types
const ( EntrypointTypeExternal = "EXTERNAL" EntrypointTypeConstructor = "CONSTRUCTOR" EntrypointTypeL1Handler = "L1_HANDLER" )
entrypoint types
Variables ¶
var ( ErrTooShortCallData = errors.New("calldata is too short") ErrInvalidTupleType = errors.New("invalid tuple type") ErrNoLenField = errors.New("can't find array length field") )
errors
var ( ExecuteFunction = FunctionItem{ Type: Type{ Type: FunctionType, Name: encoding.ExecuteEntrypoint, }, Inputs: []Type{ { Name: "call_array_len", Type: "felt", }, { Name: "call_array", Type: "CallArray*", }, { Name: "calldata_len", Type: "felt", }, { Name: "calldata", Type: "felt*", }, }, Outputs: []Type{ { Name: "response_len", Type: "felt", }, { Name: "response", Type: "felt*", }, }, } CallArray = StructItem{ Type: Type{ Type: StructType, Name: "CallArray", }, Size: 4, Members: []Member{ { Type: Type{ Type: "felt", Name: "to", }, Offset: 0, }, { Type: Type{ Type: "felt", Name: "selector", }, Offset: 1, }, { Type: Type{ Type: "felt", Name: "data_offset", }, Offset: 2, }, { Type: Type{ Type: "felt", Name: "data_len", }, Offset: 3, }, }, } ChangeModules = FunctionItem{ Type: Type{ Type: FunctionType, Name: encoding.ChangeModulesEntrypoint, }, Inputs: []Type{ { Name: "actions_len", Type: "felt", }, { Name: "actions", Type: "ModuleFunctionAction*", }, { Name: "address", Type: "felt", }, { Name: "calldata_len", Type: "felt", }, { Name: "calldata", Type: "felt*", }, }, Outputs: []Type{ { Name: "response_len", Type: "felt", }, { Name: "response", Type: "felt*", }, }, } ModuleFunctionAction = StructItem{ Type: Type{ Type: StructType, Name: "ModuleFunctionAction", }, Size: 3, Members: []Member{ { Type: Type{ Type: "felt", Name: "module_address", }, Offset: 0, }, { Type: Type{ Type: "felt", Name: "action", }, Offset: 1, }, { Type: Type{ Type: "felt", Name: "selector", }, Offset: 2, }, }, } )
default types
Functions ¶
func DecodeChangeModulesCallData ¶
DecodeChangeModulesCallData -
func DecodeEventData ¶
func DecodeEventData(data []string, typ EventItem, structs map[string]*StructItem) (map[string]any, error)
DecodeEventData -
func DecodeExecuteCallData ¶
DecodeExecuteCallData -
func DecodeFunctionCallData ¶
func DecodeFunctionCallData(calldata []string, typ FunctionItem, structs map[string]*StructItem) (map[string]any, error)
DecodeFunctionCallData -
Types ¶
type Abi ¶
type Abi struct { Functions map[string]*FunctionItem `json:"-"` L1Handlers map[string]*FunctionItem `json:"-"` Constructor map[string]*FunctionItem `json:"-"` Events map[string]*EventItem `json:"-"` Structs map[string]*StructItem `json:"-"` FunctionsBySelector map[string]*FunctionItem `json:"-"` L1HandlersBySelector map[string]*FunctionItem `json:"-"` ConstructorBySelector map[string]*FunctionItem `json:"-"` EventsBySelector map[string]*EventItem `json:"-"` StructsBySelector map[string]*StructItem `json:"-"` Names map[string]string `json:"-"` }
Abi -
func (*Abi) GetByTypeAndSelector ¶
GetByTypeAndSelector - receives abi type by entrypoint type and selector
func (*Abi) GetConstructorBySelector ¶
func (a *Abi) GetConstructorBySelector(selector string) (*FunctionItem, bool)
GetConstructorBySelector - receives constructor's ABI by selector. Selector may has prefix 0x and left-padding zeroes.
func (*Abi) GetEventBySelector ¶
GetEventBySelector - receives event's ABI by selector. Selector may has prefix 0x and left-padding zeroes.
func (*Abi) GetFunctionBySelector ¶
func (a *Abi) GetFunctionBySelector(selector string) (*FunctionItem, bool)
GetFunctionBySelector - receives function's ABI by selector. Selector may has prefix 0x and left-padding zeroes.
func (*Abi) GetL1HandlerBySelector ¶
func (a *Abi) GetL1HandlerBySelector(selector string) (*FunctionItem, bool)
GetL1HandlerBySelector - receives l1 handler's ABI by selector. Selector may has prefix 0x and left-padding zeroes.
func (*Abi) GetStructBySelector ¶
func (a *Abi) GetStructBySelector(selector string) (*StructItem, bool)
GetStructBySelector - receives struct's ABI by selector. Selector may has prefix 0x and left-padding zeroes.
type FunctionItem ¶
FunctionItem -
type StructItem ¶
StructItem -