types

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeVouch = "vouch"

	AttributeValueCategory = ModuleName
)

user module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "user"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	// QuerierKey to be used for querierer msgs
	QuerierKey = ModuleName
)
View Source
const (
	DefaultParamspace string = ModuleName
	DefaultVouchCount uint32 = 3
)

Default parameter namespace

View Source
const (
	TypeMsgVouch = "user_vouch"
)

msg types

Variables

View Source
var (
	ErrPostNotFound = sdkerrors.Register(ModuleName, 1, "Post not found")
	ErrAlreadyVoted = sdkerrors.Register(ModuleName, 2, "Already voted")
)

You can see how they are constructed below:

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// KeyPrefixVoucher 0x00 | voucher | vouched -> Vouch
	KeyPrefixVoucher = []byte{0x00}

	// KeyPrefixVouched 0x01 | vouched -> Vouch
	KeyPrefixVouched = []byte{0x01}
)
View Source
var (
	KeyThresholdAmount = []byte("ThresholdAmount")
	KeyVouchCount      = []byte("VouchCount")
)

Parameter store keys

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthUser        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowUser          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupUser = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	DefaultThresholdAmount sdk.Coins = sdk.NewCoins(sdk.NewInt64Coin(curatingtypes.DefaultStakeDenom, 1000000))
)

Default vars

View Source
var (
	// ModuleCdc references the global x/curating module codec. Note, the codec
	// should ONLY be used in certain instances of tests and for JSON encoding.
	ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the curating module interfaces to protobuf Any.

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func VouchedKey

func VouchedKey(vouched sdk.AccAddress) []byte

VouchedKey gets the key for a vouched address

func VoucherKey

func VoucherKey(voucher, vouched sdk.AccAddress) []byte

VoucherKey gets the key four voucher | vouched

func VoucherPrefixKey

func VoucherPrefixKey(voucher sdk.AccAddress) []byte

VoucherPrefixKey gets the key for a voucher

Types

type AccountKeeper

type AccountKeeper interface {
	IterateAccounts(ctx sdk.Context, process func(authtypes.AccountI) (stop bool))
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation

	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
	SetModuleAccount(sdk.Context, authtypes.ModuleAccountI)
}

AccountKeeper defines the expected account keeper (noalias)

type BankKeeper

type BankKeeper interface {
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error
	LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type GenesisState

type GenesisState struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState - default GenesisState

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate validates the x/user genesis parameters

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type MsgClient

type MsgClient interface {
	// Vouch defines a method for vouching for a user.
	Vouch(ctx context.Context, in *MsgVouch, opts ...grpc.CallOption) (*MsgVouchResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgServer

type MsgServer interface {
	// Vouch defines a method for vouching for a user.
	Vouch(context.Context, *MsgVouch) (*MsgVouchResponse, error)
}

MsgServer is the server API for Msg service.

type MsgVouch

type MsgVouch struct {
	Voucher string `protobuf:"bytes,1,opt,name=voucher,proto3" json:"voucher" yaml:"voucher"`
	Vouched string `protobuf:"bytes,2,opt,name=vouched,proto3" json:"vouched" yaml:"vouched"`
	Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty" yaml:"comment"`
}

func NewMsgVouch

func NewMsgVouch(
	voucher sdk.AccAddress,
	vouched sdk.AccAddress,
	comment string,
) MsgVouch

NewMsgVouch returns a new instance of MsgVouch

func (*MsgVouch) Descriptor

func (*MsgVouch) Descriptor() ([]byte, []int)

func (*MsgVouch) GetComment

func (m *MsgVouch) GetComment() string

func (MsgVouch) GetSignBytes

func (msg MsgVouch) GetSignBytes() []byte

GetSignBytes gets the bytes for the message signer to sign on

func (MsgVouch) GetSigners

func (msg MsgVouch) GetSigners() []sdk.AccAddress

GetSigners returns the signers need to sign the msg

func (*MsgVouch) GetVouched

func (m *MsgVouch) GetVouched() string

func (*MsgVouch) GetVoucher

func (m *MsgVouch) GetVoucher() string

func (*MsgVouch) Marshal

func (m *MsgVouch) Marshal() (dAtA []byte, err error)

func (*MsgVouch) MarshalTo

func (m *MsgVouch) MarshalTo(dAtA []byte) (int, error)

func (*MsgVouch) MarshalToSizedBuffer

func (m *MsgVouch) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgVouch) ProtoMessage

func (*MsgVouch) ProtoMessage()

func (*MsgVouch) Reset

func (m *MsgVouch) Reset()

func (MsgVouch) Route

func (msg MsgVouch) Route() string

Route returns the route key

func (*MsgVouch) Size

func (m *MsgVouch) Size() (n int)

func (*MsgVouch) String

func (m *MsgVouch) String() string

func (MsgVouch) Type

func (msg MsgVouch) Type() string

Type returns the type

func (*MsgVouch) Unmarshal

func (m *MsgVouch) Unmarshal(dAtA []byte) error

func (MsgVouch) ValidateBasic

func (msg MsgVouch) ValidateBasic() error

ValidateBasic validity check for the AnteHandler

func (*MsgVouch) XXX_DiscardUnknown

func (m *MsgVouch) XXX_DiscardUnknown()

func (*MsgVouch) XXX_Marshal

func (m *MsgVouch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgVouch) XXX_Merge

func (m *MsgVouch) XXX_Merge(src proto.Message)

func (*MsgVouch) XXX_Size

func (m *MsgVouch) XXX_Size() int

func (*MsgVouch) XXX_Unmarshal

func (m *MsgVouch) XXX_Unmarshal(b []byte) error

type MsgVouchResponse

type MsgVouchResponse struct {
}

func (*MsgVouchResponse) Descriptor

func (*MsgVouchResponse) Descriptor() ([]byte, []int)

func (*MsgVouchResponse) Marshal

func (m *MsgVouchResponse) Marshal() (dAtA []byte, err error)

func (*MsgVouchResponse) MarshalTo

func (m *MsgVouchResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgVouchResponse) MarshalToSizedBuffer

func (m *MsgVouchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgVouchResponse) ProtoMessage

func (*MsgVouchResponse) ProtoMessage()

func (*MsgVouchResponse) Reset

func (m *MsgVouchResponse) Reset()

func (*MsgVouchResponse) Size

func (m *MsgVouchResponse) Size() (n int)

func (*MsgVouchResponse) String

func (m *MsgVouchResponse) String() string

func (*MsgVouchResponse) Unmarshal

func (m *MsgVouchResponse) Unmarshal(dAtA []byte) error

func (*MsgVouchResponse) XXX_DiscardUnknown

func (m *MsgVouchResponse) XXX_DiscardUnknown()

func (*MsgVouchResponse) XXX_Marshal

func (m *MsgVouchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgVouchResponse) XXX_Merge

func (m *MsgVouchResponse) XXX_Merge(src proto.Message)

func (*MsgVouchResponse) XXX_Size

func (m *MsgVouchResponse) XXX_Size() int

func (*MsgVouchResponse) XXX_Unmarshal

func (m *MsgVouchResponse) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	ThresholdAmount github_com_cosmos_cosmos_sdk_types.Coins `` /* 174-byte string literal not displayed */
	VouchCount      uint32                                   `protobuf:"varint,2,opt,name=vouch_count,json=vouchCount,proto3" json:"vouch_count,omitempty" yaml:"vouch_count"`
}

func DefaultParams

func DefaultParams() Params

DefaultParams defines the parameters for this module

func NewParams

func NewParams(thresholdAmount sdk.Coins, vouchCount uint32) Params

NewParams creates a new Params object

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetThresholdAmount

func (m *Params) GetThresholdAmount() github_com_cosmos_cosmos_sdk_types.Coins

func (*Params) GetVouchCount

func (m *Params) GetVouchCount() uint32

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs - Implements params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate validates all params

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryParamsRequest

type QueryParamsRequest struct {
}

func (*QueryParamsRequest) Descriptor

func (*QueryParamsRequest) Descriptor() ([]byte, []int)

func (*QueryParamsRequest) Marshal

func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)

func (*QueryParamsRequest) MarshalTo

func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsRequest) MarshalToSizedBuffer

func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

func (m *QueryParamsRequest) Size() (n int)

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsRequest) XXX_Merge

func (m *QueryParamsRequest) XXX_Merge(src proto.Message)

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error

type QueryParamsResponse

type QueryParamsResponse struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
}

QueryServer is the server API for Query service.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) Vouch

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

type Vouch

type Vouch struct {
	Voucher string `protobuf:"bytes,1,opt,name=voucher,proto3" json:"voucher,omitempty" yaml:"voucher"`
	Vouched string `protobuf:"bytes,2,opt,name=vouched,proto3" json:"vouched,omitempty" yaml:"vouched"`
	Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty" yaml:"comment"`
}

func NewVouch

func NewVouch(voucher, vouched sdk.AccAddress, comment string) Vouch

NewVouch returns a new instance of the Vouch object

func (*Vouch) Descriptor

func (*Vouch) Descriptor() ([]byte, []int)

func (*Vouch) GetComment

func (m *Vouch) GetComment() string

func (*Vouch) GetVouched

func (m *Vouch) GetVouched() string

func (*Vouch) GetVoucher

func (m *Vouch) GetVoucher() string

func (*Vouch) Marshal

func (m *Vouch) Marshal() (dAtA []byte, err error)

func (*Vouch) MarshalTo

func (m *Vouch) MarshalTo(dAtA []byte) (int, error)

func (*Vouch) MarshalToSizedBuffer

func (m *Vouch) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Vouch) ProtoMessage

func (*Vouch) ProtoMessage()

func (*Vouch) Reset

func (m *Vouch) Reset()

func (*Vouch) Size

func (m *Vouch) Size() (n int)

func (*Vouch) String

func (m *Vouch) String() string

func (*Vouch) Unmarshal

func (m *Vouch) Unmarshal(dAtA []byte) error

func (*Vouch) XXX_DiscardUnknown

func (m *Vouch) XXX_DiscardUnknown()

func (*Vouch) XXX_Marshal

func (m *Vouch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vouch) XXX_Merge

func (m *Vouch) XXX_Merge(src proto.Message)

func (*Vouch) XXX_Size

func (m *Vouch) XXX_Size() int

func (*Vouch) XXX_Unmarshal

func (m *Vouch) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL