Documentation ¶
Index ¶
- Variables
- func Call(ctx Context, addr loom.Address, inpb proto.Message, outpb proto.Message) error
- func CallEVM(ctx Context, addr loom.Address, input []byte, output *[]byte) error
- func CallMethod(ctx Context, addr loom.Address, method string, inpb proto.Message, ...) error
- func MakePluginContract(c Contract) plugin.Contract
- func StaticCall(ctx StaticContext, addr loom.Address, inpb proto.Message, outpb proto.Message) error
- func StaticCallEVM(ctx StaticContext, addr loom.Address, input []byte, output *[]byte) error
- func StaticCallMethod(ctx StaticContext, addr loom.Address, method string, inpb proto.Message, ...) error
- type BinaryPBMarshaler
- type BinaryPBUnmarshaler
- type Context
- type Contract
- type PBMarshaler
- type PBUnmarshaler
- type RequestDispatcher
- type StaticContext
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
View Source
var (
ErrServiceNotFound = errors.New("service not found")
)
Functions ¶
func CallMethod ¶
func MakePluginContract ¶
func StaticCall ¶
func StaticCallEVM ¶
func StaticCallEVM(ctx StaticContext, addr loom.Address, input []byte, output *[]byte) error
func StaticCallMethod ¶
Types ¶
type BinaryPBMarshaler ¶
type BinaryPBMarshaler struct { }
type BinaryPBUnmarshaler ¶
type BinaryPBUnmarshaler struct { }
type Context ¶
type Context interface { plugin.VolatileAPI StaticContext Set(key []byte, pb proto.Message) error Delete(key []byte) HasPermission(token []byte, roles []string) (bool, []string) GrantPermissionTo(addr loom.Address, token []byte, role string) RevokePermissionFrom(addr loom.Address, token []byte, role string) GrantPermission(token []byte, roles []string) }
Context is the high-level context provided to Go contract methods that mutate state.
func WrapPluginContext ¶
type PBMarshaler ¶
func MarshalerFactory ¶
func MarshalerFactory(encoding plugin.EncodingType) (PBMarshaler, error)
type PBUnmarshaler ¶
func UnmarshalerFactory ¶
func UnmarshalerFactory(encoding plugin.EncodingType) (PBUnmarshaler, error)
type RequestDispatcher ¶
type RequestDispatcher struct { Contract // contains filtered or unexported fields }
RequestDispatcher dispatches Request(s) to contract methods. The dispatcher takes care of unmarshalling requests and marshalling responses from/to protobufs or JSON - based on the content type specified in the Request.ContentType/Accept fields.
func NewRequestDispatcher ¶
func NewRequestDispatcher(contract Contract) (*RequestDispatcher, error)
func (*RequestDispatcher) StaticCall ¶
func (s *RequestDispatcher) StaticCall(ctx plugin.StaticContext, req *plugin.Request) (*plugin.Response, error)
type StaticContext ¶
type StaticContext interface { plugin.StaticAPI Get(key []byte, pb proto.Message) error Range(prefix []byte) plugin.RangeData Has(key []byte) bool Block() loom.BlockHeader Now() time.Time Message() plugin.Message ContractAddress() loom.Address Logger() *loom.Logger GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error) HasPermissionFor(addr loom.Address, token []byte, roles []string) (bool, []string) FeatureEnabled(name string, defaultVal bool) bool Config() *cctypes.Config Validators() []*types.Validator EnabledFeatures() []string // ContractRecord retrieves the contract meta data stored in the Registry. // NOTE: This method requires Registry v2. ContractRecord(contractAddr loom.Address) (*plugin.ContractRecord, error) }
StaticContext is the high-level context provided to Go contract methods that don't mutate state.
func WrapPluginStaticContext ¶
func WrapPluginStaticContext(ctx plugin.StaticContext) StaticContext
Click to show internal directories.
Click to hide internal directories.