{"modulePath":"github.com/LOOMNETWORK/GO-LOOM","version":"v0.0.0-20210524052030-e0cfe8bf35cc","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugin\n\n## Constants\n\n```go\nconst Name = \"gogoproto\"\n```\nName is the name registered for the proto compressor.\n\n## Variables\n\n```go\nvar (\n\tEncodingType_JSON      = ptypes.EncodingType_JSON\n\tEncodingType_PROTOBUF3 = ptypes.EncodingType_PROTOBUF3\n)\n```\n\n```go\nvar Handshake = extplugin.HandshakeConfig{\n\tProtocolVersion:  1,\n\tMagicCookieKey:   \"LOOM_CONTRACT\",\n\tMagicCookieValue: \"loomrocks\",\n}\n```\nHandshake is a common handshake that is shared by plugin and host.\n\n## Functions\n\n```go\nfunc Serve(contract Contract)\n```\n\n## Types\n\n```go\ntype API interface {\n\tStaticAPI\n\tVolatileAPI\n}\n```\n\n```go\ntype Code = ptypes.PluginCode\n```\n\n```go\ntype Context interface {\n\tStaticContext\n\tVolatileAPI\n\tSet(key, value []byte)\n\tDelete(key []byte)\n}\n```\nContext is the low-level context provided to RequestDispatcher.StaticCall().\n\n```go\ntype Contract interface {\n\tMeta() (Meta, error)\n\tInit(ctx Context, req *Request) error\n\tCall(ctx Context, req *Request) (*Response, error)\n\tStaticCall(ctx StaticContext, req *Request) (*Response, error)\n}\n```\n\n```go\ntype ContractMethodCall = ptypes.ContractMethodCall\n```\n\n```go\ntype ContractRecord struct {\n\tContractName    string\n\tContractAddress loom.Address\n\tCreatorAddress  loom.Address\n}\n```\n\n```go\ntype EncodingType = ptypes.EncodingType\n```\n\n```go\ntype ExternalPlugin struct {\n\textplugin.NetRPCUnsupportedPlugin\n\t// Concrete implementation, written in Go. This is only used for plugins\n\t// that are written in Go.\n\tImpl Contract\n}\n```\n\n```go\nfunc (p *ExternalPlugin) GRPCClient(ctx context.Context, broker *extplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)\n```\n\n```go\nfunc (p *ExternalPlugin) GRPCServer(broker *extplugin.GRPCBroker, s *grpc.Server) error\n```\n\n```go\ntype FEvent struct {\n\tEvent  []byte\n\tTopics []string\n}\n```\n\n```go\ntype FakeContext struct {\n\tEvents []FEvent\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc CreateFakeContext(caller, address loom.Address) *FakeContext\n```\n\n```go\nfunc (c *FakeContext) Block() types.BlockHeader\n```\n\n```go\nfunc (c *FakeContext) Call(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\nfunc (c *FakeContext) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)\n```\n\n```go\nfunc (c *FakeContext) Config() *cctypes.Config\n```\n\n```go\nfunc (c *FakeContext) ContractAddress() loom.Address\n```\n\n```go\nfunc (c *FakeContext) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)\n```\n\n```go\nfunc (c *FakeContext) CreateContract(contract Contract) loom.Address\n```\n\n```go\nfunc (c *FakeContext) Delete(key []byte)\n```\n\n```go\nfunc (c *FakeContext) Emit(event []byte)\n```\n\n```go\nfunc (c *FakeContext) EmitTopics(event []byte, topics ...string)\n```\n\n```go\nfunc (c *FakeContext) EnabledFeatures() []string\n```\n\n```go\nfunc (c *FakeContext) FeatureEnabled(name string, defaultVal bool) bool\n```\n\n```go\nfunc (c *FakeContext) Get(key []byte) []byte\n```\n\n```go\nfunc (c *FakeContext) GetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)\n```\n\n```go\nfunc (c *FakeContext) Has(key []byte) bool\n```\n\n```go\nfunc (c *FakeContext) Message() Message\n```\n\n```go\nfunc (c *FakeContext) Now() time.Time\n```\n\n```go\nfunc (c *FakeContext) Range(prefix []byte) RangeData\n```\n\n```go\nfunc (c *FakeContext) RegisterContract(contractName string, contractAddr, creatorAddr loom.Address)\n```\n\n```go\nfunc (c *FakeContext) Resolve(name string) (loom.Address, error)\n```\n\n```go\nfunc (c *FakeContext) Set(key []byte, value []byte)\n```\n\n```go\nfunc (c *FakeContext) SetConfigSetting(name, value string) error\n```\n\n```go\nfunc (c *FakeContext) SetFeature(name string, val bool)\n```\n\n```go\nfunc (c *FakeContext) SetTime(t time.Time)\n```\n\n```go\nfunc (c *FakeContext) StaticCall(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\nfunc (c *FakeContext) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\nfunc (c *FakeContext) Validators() []*loom.Validator\n```\n\n```go\nfunc (c *FakeContext) WithAddress(addr loom.Address) *FakeContext\n```\n\n```go\nfunc (c *FakeContext) WithBlock(header loom.BlockHeader) *FakeContext\n```\n\n```go\nfunc (c *FakeContext) WithSender(caller loom.Address) *FakeContext\n```\n\n```go\nfunc (c *FakeContext) WithValidators(validators []*types.Validator) *FakeContext\n```\n\n```go\ntype GRPCAPIClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (c *GRPCAPIClient) Call(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) CallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) ContractRecord(contractAddr loom.Address) (*ContractRecord, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) Delete(key []byte)\n```\n\n```go\nfunc (c *GRPCAPIClient) Get(key []byte) []byte\n```\n\n```go\nfunc (c *GRPCAPIClient) GetEvmTxReceipt(hash []byte) (types.EvmTxReceipt, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) Has(key []byte) bool\n```\n\n```go\nfunc (c *GRPCAPIClient) Range(prefix []byte) RangeData\n```\n\n```go\nfunc (c *GRPCAPIClient) Resolve(name string) (loom.Address, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) Set(key, value []byte)\n```\n\n```go\nfunc (c *GRPCAPIClient) StaticCall(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\nfunc (c *GRPCAPIClient) StaticCallEVM(addr loom.Address, input []byte) ([]byte, error)\n```\n\n```go\ntype GRPCContext struct {\n\t*GRPCAPIClient\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc MakeGRPCContext(conn *grpc.ClientConn, req *types.ContractCallRequest) *GRPCContext\n```\n\n```go\nfunc (c *GRPCContext) Block() loom.BlockHeader\n```\n\n```go\nfunc (c *GRPCContext) Config() *cctypes.Config\n```\n\n```go\nfunc (c *GRPCContext) ContractAddress() loom.Address\n```\n\n```go\nfunc (c *GRPCContext) Emit(data []byte)\n```\n\n```go\nfunc (c *GRPCContext) EmitTopics(data []byte, topics ...string)\n```\n\n```go\nfunc (c *GRPCContext) EnabledFeatures() []string\n```\n\n```go\nfunc (c *GRPCContext) FeatureEnabled(name string, defaultVal bool) bool\n```\n\n```go\nfunc (c *GRPCContext) Message() Message\n```\n\n```go\nfunc (c *GRPCContext) Now() time.Time\n```\n\n```go\nfunc (c *GRPCContext) Validators() []*ltypes.Validator\n```\n\n```go\ntype GRPCContractServer struct {\n\tImpl Contract\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (s *GRPCContractServer) Call(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)\n```\n\n```go\nfunc (s *GRPCContractServer) Init(ctx context.Context, req *types.ContractCallRequest) (*types.InitResponse, error)\n```\n\n```go\nfunc (s *GRPCContractServer) Meta(ctx context.Context, req *types.MetaRequest) (*types.ContractMeta, error)\n```\n\n```go\nfunc (s *GRPCContractServer) StaticCall(ctx context.Context, req *types.ContractCallRequest) (*types.Response, error)\n```\n\n```go\ntype Message struct {\n\tSender loom.Address\n}\n```\n\n```go\ntype Meta = ptypes.ContractMeta\n```\n\n```go\ntype RangeData []*RangeEntry\n```\nRangeData an array of key value pairs for a range of data\n\n```go\ntype RangeEntry struct {\n\tKey   []byte\n\tValue []byte\n}\n```\nRangeEntry a single entry in a range\n\n```go\ntype Request = ptypes.Request\n```\n\n```go\ntype Response = ptypes.Response\n```\n\n```go\ntype StaticAPI interface {\n\tStaticCall(addr loom.Address, input []byte) ([]byte, error)\n\tStaticCallEVM(addr loom.Address, input []byte) ([]byte, error)\n\tResolve(name string) (loom.Address, error)\n\tEmitTopics(event []byte, topics ...string)\n\tEmit(event []byte)\n}\n```\n\n```go\ntype StaticContext interface {\n\tStaticAPI\n\tGet(key []byte) []byte\n\tHas(key []byte) bool\n\tRange(prefix []byte) RangeData\n\tBlock() loom.BlockHeader\n\tNow() time.Time\n\tMessage() Message\n\tGetEvmTxReceipt([]byte) (ptypes.EvmTxReceipt, error)\n\tContractAddress() loom.Address\n\tFeatureEnabled(name string, defaultVal bool) bool\n\tConfig() *cctypes.Config\n\tEnabledFeatures() []string\n\tValidators() []*types.Validator\n\t// ContractRecord retrieves the contract meta data stored in the Registry.\n\t// NOTE: This method requires Registry v2.\n\tContractRecord(contractAddr loom.Address) (*ContractRecord, error)\n}\n```\nStaticContext 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).\n\n```go\ntype VolatileAPI interface {\n\tCall(addr loom.Address, input []byte) ([]byte, error)\n\tCallEVM(addr loom.Address, input []byte, value *loom.BigUInt) ([]byte, error)\n}\n```\n\n","path":"github.com/LOOMNETWORK/GO-LOOM/plugin","name":"plugin","synopsis":"","isRedistributable":true}
