Documentation
¶
Overview ¶
Package config contains
- chaincode methods names {service_name}Chaincode_{method_name}
- chaincode interface definition {service_name}Chaincode
- chaincode gateway definition {service_name}}Gateway
- chaincode service to cckit router registration func
Package config is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterConfigServiceChaincode(r *cckit_router.Group, cc ConfigServiceChaincode) error
- func RegisterConfigServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigServiceClient) error
- func RegisterConfigServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error
- func RegisterConfigServiceServer(s *grpc.Server, srv ConfigServiceServer)
- type ConfigServiceChaincode
- type ConfigServiceChaincodeLocalResolver
- type ConfigServiceChaincodeLocatorResolver
- type ConfigServiceChaincodeResolver
- type ConfigServiceChaincodeStubInvoker
- func (c *ConfigServiceChaincodeStubInvoker) GetDecimals(ctx cckit_router.Context, in *emptypb.Empty) (*DecimalsResponse, error)
- func (c *ConfigServiceChaincodeStubInvoker) GetName(ctx cckit_router.Context, in *emptypb.Empty) (*NameResponse, error)
- func (c *ConfigServiceChaincodeStubInvoker) GetSymbol(ctx cckit_router.Context, in *emptypb.Empty) (*SymbolResponse, error)
- func (c *ConfigServiceChaincodeStubInvoker) GetTotalSupply(ctx cckit_router.Context, in *emptypb.Empty) (*TotalSupplyResponse, error)
- type ConfigServiceClient
- type ConfigServiceGateway
- func (c *ConfigServiceGateway) GetDecimals(ctx context.Context, in *emptypb.Empty) (*DecimalsResponse, error)
- func (c *ConfigServiceGateway) GetName(ctx context.Context, in *emptypb.Empty) (*NameResponse, error)
- func (c *ConfigServiceGateway) GetSymbol(ctx context.Context, in *emptypb.Empty) (*SymbolResponse, error)
- func (c *ConfigServiceGateway) GetTotalSupply(ctx context.Context, in *emptypb.Empty) (*TotalSupplyResponse, error)
- func (c *ConfigServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
- func (c *ConfigServiceGateway) ServiceDef() cckit_gateway.ServiceDef
- type ConfigServiceServer
- type DecimalsResponse
- func (*DecimalsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DecimalsResponse) GetDecimals() uint32
- func (*DecimalsResponse) ProtoMessage()
- func (x *DecimalsResponse) ProtoReflect() protoreflect.Message
- func (x *DecimalsResponse) Reset()
- func (x *DecimalsResponse) String() string
- func (this *DecimalsResponse) Validate() error
- type NameResponse
- func (*NameResponse) Descriptor() ([]byte, []int)deprecated
- func (x *NameResponse) GetName() string
- func (*NameResponse) ProtoMessage()
- func (x *NameResponse) ProtoReflect() protoreflect.Message
- func (x *NameResponse) Reset()
- func (x *NameResponse) String() string
- func (this *NameResponse) Validate() error
- type Service
- func (s *Service) GetDecimals(ctx router.Context, e *emptypb.Empty) (*DecimalsResponse, error)
- func (s *Service) GetName(ctx router.Context, e *emptypb.Empty) (*NameResponse, error)
- func (s *Service) GetSymbol(ctx router.Context, e *emptypb.Empty) (*SymbolResponse, error)
- func (s *Service) GetTotalSupply(ctx router.Context, e *emptypb.Empty) (*TotalSupplyResponse, error)
- type SymbolResponse
- func (*SymbolResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SymbolResponse) GetSymbol() string
- func (*SymbolResponse) ProtoMessage()
- func (x *SymbolResponse) ProtoReflect() protoreflect.Message
- func (x *SymbolResponse) Reset()
- func (x *SymbolResponse) String() string
- func (this *SymbolResponse) Validate() error
- type TotalSupplyResponse
- func (*TotalSupplyResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TotalSupplyResponse) GetTotalSupply() *decimal.Decimal
- func (*TotalSupplyResponse) ProtoMessage()
- func (x *TotalSupplyResponse) ProtoReflect() protoreflect.Message
- func (x *TotalSupplyResponse) Reset()
- func (x *TotalSupplyResponse) String() string
- func (this *TotalSupplyResponse) Validate() error
- type UnimplementedConfigServiceServer
- func (*UnimplementedConfigServiceServer) GetDecimals(context.Context, *emptypb.Empty) (*DecimalsResponse, error)
- func (*UnimplementedConfigServiceServer) GetName(context.Context, *emptypb.Empty) (*NameResponse, error)
- func (*UnimplementedConfigServiceServer) GetSymbol(context.Context, *emptypb.Empty) (*SymbolResponse, error)
- func (*UnimplementedConfigServiceServer) GetTotalSupply(context.Context, *emptypb.Empty) (*TotalSupplyResponse, error)
Constants ¶
const ( // ConfigServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode ConfigServiceChaincodeMethodPrefix = "" ConfigServiceChaincode_GetName = ConfigServiceChaincodeMethodPrefix + "GetName" ConfigServiceChaincode_GetSymbol = ConfigServiceChaincodeMethodPrefix + "GetSymbol" ConfigServiceChaincode_GetDecimals = ConfigServiceChaincodeMethodPrefix + "GetDecimals" ConfigServiceChaincode_GetTotalSupply = ConfigServiceChaincodeMethodPrefix + "GetTotalSupply" )
ConfigServiceChaincode method names
Variables ¶
var ConfigServiceSwagger []byte
var File_erc20_utxo_service_config_config_proto protoreflect.FileDescriptor
Functions ¶
func RegisterConfigServiceChaincode ¶
func RegisterConfigServiceChaincode(r *cckit_router.Group, cc ConfigServiceChaincode) error
RegisterConfigServiceChaincode registers service methods as chaincode router handlers
func RegisterConfigServiceHandler ¶
func RegisterConfigServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterConfigServiceHandler registers the http handlers for service ConfigService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterConfigServiceHandlerClient ¶
func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigServiceClient) error
RegisterConfigServiceHandlerClient registers the http handlers for service ConfigService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ConfigServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ConfigServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ConfigServiceClient" to call the correct interceptors.
func RegisterConfigServiceHandlerFromEndpoint ¶
func RegisterConfigServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterConfigServiceHandlerFromEndpoint is same as RegisterConfigServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterConfigServiceHandlerServer ¶
func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error
RegisterConfigServiceHandlerServer registers the http handlers for service ConfigService to "mux". UnaryRPC :call ConfigServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterConfigServiceHandlerFromEndpoint instead.
func RegisterConfigServiceServer ¶
func RegisterConfigServiceServer(s *grpc.Server, srv ConfigServiceServer)
Types ¶
type ConfigServiceChaincode ¶
type ConfigServiceChaincode interface { GetName(cckit_router.Context, *emptypb.Empty) (*NameResponse, error) GetSymbol(cckit_router.Context, *emptypb.Empty) (*SymbolResponse, error) GetDecimals(cckit_router.Context, *emptypb.Empty) (*DecimalsResponse, error) GetTotalSupply(cckit_router.Context, *emptypb.Empty) (*TotalSupplyResponse, error) }
ConfigServiceChaincode chaincode methods interface
type ConfigServiceChaincodeLocalResolver ¶
type ConfigServiceChaincodeLocalResolver struct {
// contains filtered or unexported fields
}
ConfigServiceChaincodeResolver interface for service resolver
func NewConfigServiceChaincodeLocalResolver ¶
func NewConfigServiceChaincodeLocalResolver(service ConfigServiceChaincode) *ConfigServiceChaincodeLocalResolver
func (*ConfigServiceChaincodeLocalResolver) Resolve ¶
func (r *ConfigServiceChaincodeLocalResolver) Resolve(ctx cckit_router.Context) (ConfigServiceChaincode, error)
type ConfigServiceChaincodeLocatorResolver ¶
type ConfigServiceChaincodeLocatorResolver struct {
// contains filtered or unexported fields
}
ConfigServiceChaincodeResolver interface for service resolver
func NewConfigServiceChaincodeResolver ¶
func NewConfigServiceChaincodeResolver(locatorResolver cckit_gateway.ChaincodeLocatorResolver) *ConfigServiceChaincodeLocatorResolver
func (*ConfigServiceChaincodeLocatorResolver) Resolve ¶
func (r *ConfigServiceChaincodeLocatorResolver) Resolve(ctx cckit_router.Context) (ConfigServiceChaincode, error)
type ConfigServiceChaincodeResolver ¶
type ConfigServiceChaincodeResolver interface {
Resolve(ctx cckit_router.Context) (ConfigServiceChaincode, error)
}
ConfigServiceChaincodeResolver interface for service resolver
type ConfigServiceChaincodeStubInvoker ¶
type ConfigServiceChaincodeStubInvoker struct {
Invoker cckit_gateway.ChaincodeStubInvoker
}
func NewConfigServiceChaincodeStubInvoker ¶
func NewConfigServiceChaincodeStubInvoker(locator *cckit_gateway.ChaincodeLocator) *ConfigServiceChaincodeStubInvoker
func (*ConfigServiceChaincodeStubInvoker) GetDecimals ¶
func (c *ConfigServiceChaincodeStubInvoker) GetDecimals(ctx cckit_router.Context, in *emptypb.Empty) (*DecimalsResponse, error)
func (*ConfigServiceChaincodeStubInvoker) GetName ¶
func (c *ConfigServiceChaincodeStubInvoker) GetName(ctx cckit_router.Context, in *emptypb.Empty) (*NameResponse, error)
func (*ConfigServiceChaincodeStubInvoker) GetSymbol ¶
func (c *ConfigServiceChaincodeStubInvoker) GetSymbol(ctx cckit_router.Context, in *emptypb.Empty) (*SymbolResponse, error)
func (*ConfigServiceChaincodeStubInvoker) GetTotalSupply ¶
func (c *ConfigServiceChaincodeStubInvoker) GetTotalSupply(ctx cckit_router.Context, in *emptypb.Empty) (*TotalSupplyResponse, error)
type ConfigServiceClient ¶
type ConfigServiceClient interface { // Returns the name of the token. GetName(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NameResponse, error) // Returns the symbol of the token, usually a shorter version of the name. GetSymbol(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SymbolResponse, error) // Returns the number of decimals used to get its user representation. // For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5,05 (505 / 10 ** 2). GetDecimals(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DecimalsResponse, error) // Returns the amount of tokens in existence. GetTotalSupply(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TotalSupplyResponse, error) }
ConfigServiceClient is the client API for ConfigService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewConfigServiceClient ¶
func NewConfigServiceClient(cc grpc.ClientConnInterface) ConfigServiceClient
type ConfigServiceGateway ¶
type ConfigServiceGateway struct {
ChaincodeInstance cckit_gateway.ChaincodeInstance
}
gateway implementation gateway can be used as kind of SDK, GRPC or REST server ( via grpc-gateway or clay )
func NewConfigServiceGateway ¶
func NewConfigServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *ConfigServiceGateway
NewConfigServiceGateway creates gateway to access chaincode method via chaincode service
func NewConfigServiceGatewayFromInstance ¶
func NewConfigServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *ConfigServiceGateway
func (*ConfigServiceGateway) GetDecimals ¶
func (c *ConfigServiceGateway) GetDecimals(ctx context.Context, in *emptypb.Empty) (*DecimalsResponse, error)
func (*ConfigServiceGateway) GetName ¶
func (c *ConfigServiceGateway) GetName(ctx context.Context, in *emptypb.Empty) (*NameResponse, error)
func (*ConfigServiceGateway) GetSymbol ¶
func (c *ConfigServiceGateway) GetSymbol(ctx context.Context, in *emptypb.Empty) (*SymbolResponse, error)
func (*ConfigServiceGateway) GetTotalSupply ¶
func (c *ConfigServiceGateway) GetTotalSupply(ctx context.Context, in *emptypb.Empty) (*TotalSupplyResponse, error)
func (*ConfigServiceGateway) Invoker ¶
func (c *ConfigServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
func (*ConfigServiceGateway) ServiceDef ¶
func (c *ConfigServiceGateway) ServiceDef() cckit_gateway.ServiceDef
ServiceDef returns service definition
type ConfigServiceServer ¶
type ConfigServiceServer interface { // Returns the name of the token. GetName(context.Context, *emptypb.Empty) (*NameResponse, error) // Returns the symbol of the token, usually a shorter version of the name. GetSymbol(context.Context, *emptypb.Empty) (*SymbolResponse, error) // Returns the number of decimals used to get its user representation. // For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5,05 (505 / 10 ** 2). GetDecimals(context.Context, *emptypb.Empty) (*DecimalsResponse, error) // Returns the amount of tokens in existence. GetTotalSupply(context.Context, *emptypb.Empty) (*TotalSupplyResponse, error) }
ConfigServiceServer is the server API for ConfigService service.
type DecimalsResponse ¶
type DecimalsResponse struct { Decimals uint32 `protobuf:"varint,1,opt,name=decimals,proto3" json:"decimals,omitempty"` // contains filtered or unexported fields }
func (*DecimalsResponse) Descriptor
deprecated
func (*DecimalsResponse) Descriptor() ([]byte, []int)
Deprecated: Use DecimalsResponse.ProtoReflect.Descriptor instead.
func (*DecimalsResponse) GetDecimals ¶
func (x *DecimalsResponse) GetDecimals() uint32
func (*DecimalsResponse) ProtoMessage ¶
func (*DecimalsResponse) ProtoMessage()
func (*DecimalsResponse) ProtoReflect ¶
func (x *DecimalsResponse) ProtoReflect() protoreflect.Message
func (*DecimalsResponse) Reset ¶
func (x *DecimalsResponse) Reset()
func (*DecimalsResponse) String ¶
func (x *DecimalsResponse) String() string
func (*DecimalsResponse) Validate ¶
func (this *DecimalsResponse) Validate() error
type NameResponse ¶
type NameResponse struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*NameResponse) Descriptor
deprecated
func (*NameResponse) Descriptor() ([]byte, []int)
Deprecated: Use NameResponse.ProtoReflect.Descriptor instead.
func (*NameResponse) GetName ¶
func (x *NameResponse) GetName() string
func (*NameResponse) ProtoMessage ¶
func (*NameResponse) ProtoMessage()
func (*NameResponse) ProtoReflect ¶
func (x *NameResponse) ProtoReflect() protoreflect.Message
func (*NameResponse) Reset ¶
func (x *NameResponse) Reset()
func (*NameResponse) String ¶
func (x *NameResponse) String() string
func (*NameResponse) Validate ¶
func (this *NameResponse) Validate() error
type Service ¶
type Service struct {
Token token.TokenGetter
}
func NewService ¶
func NewService(tokenGetter token.TokenGetter) *Service
func (*Service) GetDecimals ¶
func (*Service) GetTotalSupply ¶
type SymbolResponse ¶
type SymbolResponse struct { Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` // contains filtered or unexported fields }
func (*SymbolResponse) Descriptor
deprecated
func (*SymbolResponse) Descriptor() ([]byte, []int)
Deprecated: Use SymbolResponse.ProtoReflect.Descriptor instead.
func (*SymbolResponse) GetSymbol ¶
func (x *SymbolResponse) GetSymbol() string
func (*SymbolResponse) ProtoMessage ¶
func (*SymbolResponse) ProtoMessage()
func (*SymbolResponse) ProtoReflect ¶
func (x *SymbolResponse) ProtoReflect() protoreflect.Message
func (*SymbolResponse) Reset ¶
func (x *SymbolResponse) Reset()
func (*SymbolResponse) String ¶
func (x *SymbolResponse) String() string
func (*SymbolResponse) Validate ¶
func (this *SymbolResponse) Validate() error
type TotalSupplyResponse ¶
type TotalSupplyResponse struct { TotalSupply *decimal.Decimal `protobuf:"bytes,1,opt,name=total_supply,json=totalSupply,proto3" json:"total_supply,omitempty"` // contains filtered or unexported fields }
func (*TotalSupplyResponse) Descriptor
deprecated
func (*TotalSupplyResponse) Descriptor() ([]byte, []int)
Deprecated: Use TotalSupplyResponse.ProtoReflect.Descriptor instead.
func (*TotalSupplyResponse) GetTotalSupply ¶
func (x *TotalSupplyResponse) GetTotalSupply() *decimal.Decimal
func (*TotalSupplyResponse) ProtoMessage ¶
func (*TotalSupplyResponse) ProtoMessage()
func (*TotalSupplyResponse) ProtoReflect ¶
func (x *TotalSupplyResponse) ProtoReflect() protoreflect.Message
func (*TotalSupplyResponse) Reset ¶
func (x *TotalSupplyResponse) Reset()
func (*TotalSupplyResponse) String ¶
func (x *TotalSupplyResponse) String() string
func (*TotalSupplyResponse) Validate ¶
func (this *TotalSupplyResponse) Validate() error
type UnimplementedConfigServiceServer ¶
type UnimplementedConfigServiceServer struct { }
UnimplementedConfigServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedConfigServiceServer) GetDecimals ¶
func (*UnimplementedConfigServiceServer) GetDecimals(context.Context, *emptypb.Empty) (*DecimalsResponse, error)
func (*UnimplementedConfigServiceServer) GetName ¶
func (*UnimplementedConfigServiceServer) GetName(context.Context, *emptypb.Empty) (*NameResponse, error)
func (*UnimplementedConfigServiceServer) GetSymbol ¶
func (*UnimplementedConfigServiceServer) GetSymbol(context.Context, *emptypb.Empty) (*SymbolResponse, error)
func (*UnimplementedConfigServiceServer) GetTotalSupply ¶
func (*UnimplementedConfigServiceServer) GetTotalSupply(context.Context, *emptypb.Empty) (*TotalSupplyResponse, error)