Documentation ¶
Index ¶
- Constants
- Variables
- func Serve(contract Contract)
- type API
- type Code
- type Context
- type Contract
- type ContractMethodCall
- type ContractRecord
- type EncodingType
- type ExternalPlugin
- type FEvent
- type FakeContext
- func (c *FakeContext) Block() types.BlockHeader
- func (c *FakeContext) Call(addr loom.Address, input []byte) ([]byte, error)
- func (c *FakeContext) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)
- func (c *FakeContext) Config() *cctypes.Config
- func (c *FakeContext) ContractAddress() loom.Address
- func (c *FakeContext) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)
- func (c *FakeContext) CreateContract(contract Contract) loom.Address
- func (c *FakeContext) Delete(key []byte)
- func (c *FakeContext) Emit(event []byte)
- func (c *FakeContext) EmitTopics(event []byte, topics ...string)
- func (c *FakeContext) EnabledFeatures() []string
- func (c *FakeContext) FeatureEnabled(name string, defaultVal bool) bool
- func (c *FakeContext) Get(key []byte) []byte
- func (c *FakeContext) GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)
- func (c *FakeContext) Has(key []byte) bool
- func (c *FakeContext) Message() Message
- func (c *FakeContext) Now() time.Time
- func (c *FakeContext) Range(prefix []byte) RangeData
- func (c *FakeContext) RegisterContract(contractName string, contractAddr, creatorAddr loom.Address)
- func (c *FakeContext) Resolve(name string) (loom.Address, error)
- func (c *FakeContext) Set(key []byte, value []byte)
- func (c *FakeContext) SetConfigSetting(name, value string) error
- func (c *FakeContext) SetFeature(name string, val bool)
- func (c *FakeContext) SetTime(t time.Time)
- func (c *FakeContext) StaticCall(addr loom.Address, input []byte) ([]byte, error)
- func (c *FakeContext) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)
- func (c *FakeContext) Validators() []*loom.Validator
- func (c *FakeContext) WithAddress(addr loom.Address) *FakeContext
- func (c *FakeContext) WithBlock(header loom.BlockHeader) *FakeContext
- func (c *FakeContext) WithSender(caller loom.Address) *FakeContext
- func (c *FakeContext) WithValidators(validators []*types.Validator) *FakeContext
- type GRPCAPIClient
- func (c *GRPCAPIClient) Call(addr loom.Address, input []byte) ([]byte, error)
- func (c *GRPCAPIClient) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)
- func (c *GRPCAPIClient) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)
- func (c *GRPCAPIClient) Delete(key []byte)
- func (c *GRPCAPIClient) Get(key []byte) []byte
- func (c *GRPCAPIClient) GetEvmTxReceipt(hash []byte) (types.EvmTxReceipt, error)
- func (c *GRPCAPIClient) Has(key []byte) bool
- func (c *GRPCAPIClient) Range(prefix []byte) RangeData
- func (c *GRPCAPIClient) Resolve(name string) (loom.Address, error)
- func (c *GRPCAPIClient) Set(key, value []byte)
- func (c *GRPCAPIClient) StaticCall(addr loom.Address, input []byte) ([]byte, error)
- func (c *GRPCAPIClient) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)
- type GRPCContext
- func (c *GRPCContext) Block() loom.BlockHeader
- func (c *GRPCContext) Config() *cctypes.Config
- func (c *GRPCContext) ContractAddress() loom.Address
- func (c *GRPCContext) Emit(data []byte)
- func (c *GRPCContext) EmitTopics(data []byte, topics ...string)
- func (c *GRPCContext) EnabledFeatures() []string
- func (c *GRPCContext) FeatureEnabled(name string, defaultVal bool) bool
- func (c *GRPCContext) Message() Message
- func (c *GRPCContext) Now() time.Time
- func (c *GRPCContext) Validators() []*ltypes.Validator
- type GRPCContractServer
- func (s *GRPCContractServer) Call(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)
- func (s *GRPCContractServer) Init(ctx context.Context, req *types.ContractCallRequest) (*types.InitResponse, error)
- func (s *GRPCContractServer) Meta(ctx context.Context, req *types.MetaRequest) (*types.ContractMeta, error)
- func (s *GRPCContractServer) StaticCall(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)
- type Message
- type Meta
- type RangeData
- type RangeEntry
- type Request
- type Response
- type StaticAPI
- type StaticContext
- type VolatileAPI
Constants ¶
View Source
const Name = "gogoproto"
Name is the name registered for the proto compressor.
Variables ¶
View Source
var ( EncodingType_JSON = ptypes.EncodingType_JSON EncodingType_PROTOBUF3 = ptypes.EncodingType_PROTOBUF3 )
View Source
var Handshake = extplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "LOOM_CONTRACT",
MagicCookieValue: "loomrocks",
}
Handshake is a common handshake that is shared by plugin and host.
Functions ¶
Types ¶
type API ¶
type API interface { StaticAPI VolatileAPI }
type Code ¶
type Code = ptypes.PluginCode
type Context ¶
type Context interface { StaticContext VolatileAPI Set(key, value []byte) Delete(key []byte) }
Context is the low-level context provided to RequestDispatcher.StaticCall().
type ContractMethodCall ¶
type ContractMethodCall = ptypes.ContractMethodCall
type ContractRecord ¶
type EncodingType ¶
type EncodingType = ptypes.EncodingType
type ExternalPlugin ¶
type ExternalPlugin struct { extplugin.NetRPCUnsupportedPlugin // Concrete implementation, written in Go. This is only used for plugins // that are written in Go. Impl Contract }
func (*ExternalPlugin) GRPCClient ¶
func (p *ExternalPlugin) GRPCClient(ctx context.Context, broker *extplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ExternalPlugin) GRPCServer ¶
func (p *ExternalPlugin) GRPCServer(broker *extplugin.GRPCBroker, s *grpc.Server) error
type FakeContext ¶
type FakeContext struct { Events []FEvent // contains filtered or unexported fields }
func CreateFakeContext ¶
func CreateFakeContext(caller, address loom.Address) *FakeContext
func (*FakeContext) Block ¶
func (c *FakeContext) Block() types.BlockHeader
func (*FakeContext) Config ¶
func (c *FakeContext) Config() *cctypes.Config
func (*FakeContext) ContractAddress ¶
func (c *FakeContext) ContractAddress() loom.Address
func (*FakeContext) ContractRecord ¶
func (c *FakeContext) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)
func (*FakeContext) CreateContract ¶
func (c *FakeContext) CreateContract(contract Contract) loom.Address
func (*FakeContext) Delete ¶
func (c *FakeContext) Delete(key []byte)
func (*FakeContext) Emit ¶
func (c *FakeContext) Emit(event []byte)
func (*FakeContext) EmitTopics ¶
func (c *FakeContext) EmitTopics(event []byte, topics ...string)
func (*FakeContext) EnabledFeatures ¶
func (c *FakeContext) EnabledFeatures() []string
func (*FakeContext) FeatureEnabled ¶
func (c *FakeContext) FeatureEnabled(name string, defaultVal bool) bool
func (*FakeContext) Get ¶
func (c *FakeContext) Get(key []byte) []byte
func (*FakeContext) GetEvmTxReceipt ¶
func (c *FakeContext) GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)
func (*FakeContext) Has ¶
func (c *FakeContext) Has(key []byte) bool
func (*FakeContext) Message ¶
func (c *FakeContext) Message() Message
func (*FakeContext) Now ¶
func (c *FakeContext) Now() time.Time
func (*FakeContext) Range ¶
func (c *FakeContext) Range(prefix []byte) RangeData
func (*FakeContext) RegisterContract ¶
func (c *FakeContext) RegisterContract(contractName string, contractAddr, creatorAddr loom.Address)
func (*FakeContext) Set ¶
func (c *FakeContext) Set(key []byte, value []byte)
func (*FakeContext) SetConfigSetting ¶
func (c *FakeContext) SetConfigSetting(name, value string) error
func (*FakeContext) SetFeature ¶
func (c *FakeContext) SetFeature(name string, val bool)
func (*FakeContext) SetTime ¶
func (c *FakeContext) SetTime(t time.Time)
func (*FakeContext) StaticCall ¶
func (*FakeContext) StaticCallEVM ¶
func (*FakeContext) Validators ¶
func (c *FakeContext) Validators() []*loom.Validator
func (*FakeContext) WithAddress ¶
func (c *FakeContext) WithAddress(addr loom.Address) *FakeContext
func (*FakeContext) WithBlock ¶
func (c *FakeContext) WithBlock(header loom.BlockHeader) *FakeContext
func (*FakeContext) WithSender ¶
func (c *FakeContext) WithSender(caller loom.Address) *FakeContext
func (*FakeContext) WithValidators ¶
func (c *FakeContext) WithValidators(validators []*types.Validator) *FakeContext
type GRPCAPIClient ¶
type GRPCAPIClient struct {
// contains filtered or unexported fields
}
func (*GRPCAPIClient) Call ¶
func (c *GRPCAPIClient) Call(addr loom.Address, input []byte) ([]byte, error)
func (*GRPCAPIClient) CallEVM ¶
func (c *GRPCAPIClient) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)
func (*GRPCAPIClient) ContractRecord ¶
func (c *GRPCAPIClient) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)
func (*GRPCAPIClient) Delete ¶
func (c *GRPCAPIClient) Delete(key []byte)
func (*GRPCAPIClient) Get ¶
func (c *GRPCAPIClient) Get(key []byte) []byte
func (*GRPCAPIClient) GetEvmTxReceipt ¶
func (c *GRPCAPIClient) GetEvmTxReceipt(hash []byte) (types.EvmTxReceipt, error)
func (*GRPCAPIClient) Has ¶
func (c *GRPCAPIClient) Has(key []byte) bool
func (*GRPCAPIClient) Range ¶
func (c *GRPCAPIClient) Range(prefix []byte) RangeData
func (*GRPCAPIClient) Resolve ¶
func (c *GRPCAPIClient) Resolve(name string) (loom.Address, error)
func (*GRPCAPIClient) Set ¶
func (c *GRPCAPIClient) Set(key, value []byte)
func (*GRPCAPIClient) StaticCall ¶
func (c *GRPCAPIClient) StaticCall(addr loom.Address, input []byte) ([]byte, error)
func (*GRPCAPIClient) StaticCallEVM ¶
func (c *GRPCAPIClient) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)
type GRPCContext ¶
type GRPCContext struct { *GRPCAPIClient // contains filtered or unexported fields }
func MakeGRPCContext ¶
func MakeGRPCContext(conn *grpc.ClientConn, req *types.ContractCallRequest) *GRPCContext
func (*GRPCContext) Block ¶
func (c *GRPCContext) Block() loom.BlockHeader
func (*GRPCContext) Config ¶
func (c *GRPCContext) Config() *cctypes.Config
func (*GRPCContext) ContractAddress ¶
func (c *GRPCContext) ContractAddress() loom.Address
func (*GRPCContext) Emit ¶
func (c *GRPCContext) Emit(data []byte)
func (*GRPCContext) EmitTopics ¶
func (c *GRPCContext) EmitTopics(data []byte, topics ...string)
func (*GRPCContext) EnabledFeatures ¶
func (c *GRPCContext) EnabledFeatures() []string
func (*GRPCContext) FeatureEnabled ¶
func (c *GRPCContext) FeatureEnabled(name string, defaultVal bool) bool
func (*GRPCContext) Message ¶
func (c *GRPCContext) Message() Message
func (*GRPCContext) Now ¶
func (c *GRPCContext) Now() time.Time
func (*GRPCContext) Validators ¶
func (c *GRPCContext) Validators() []*ltypes.Validator
type GRPCContractServer ¶
type GRPCContractServer struct { Impl Contract // contains filtered or unexported fields }
func (*GRPCContractServer) Call ¶
func (s *GRPCContractServer) Call(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)
func (*GRPCContractServer) Init ¶
func (s *GRPCContractServer) Init(ctx context.Context, req *types.ContractCallRequest) (*types.InitResponse, error)
func (*GRPCContractServer) Meta ¶
func (s *GRPCContractServer) Meta(ctx context.Context, req *types.MetaRequest) (*types.ContractMeta, error)
func (*GRPCContractServer) StaticCall ¶
func (s *GRPCContractServer) StaticCall(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)
type Meta ¶
type Meta = ptypes.ContractMeta
type RangeData ¶
type RangeData []*RangeEntry
RangeData an array of key value pairs for a range of data
type RangeEntry ¶
RangeEntry a single entry in a range
type StaticContext ¶
type StaticContext interface { StaticAPI Get(key []byte) []byte Has(key []byte) bool Range(prefix []byte) RangeData Block() loom.BlockHeader Now() time.Time Message() Message GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error) ContractAddress() loom.Address FeatureEnabled(name string, defaultVal bool) bool Config() *cctypes.Config EnabledFeatures() []string Validators() []*types.Validator // ContractRecord retrieves the contract meta data stored in the Registry. // NOTE: This method requires Registry v2. ContractRecord(contractAddr loom.Address) (*ContractRecord, error) }
StaticContext is the low-level context provided to RequestDispatcher.Call(). The primary implementation of this interface is plugin.contractContext (loomchain/plugin package). For external GRPC contracts plugin.contractContext is wrapped by GRPCContext (go-loom/plugin package).
Click to show internal directories.
Click to hide internal directories.